Commit Graph

1069 Commits

Author SHA1 Message Date
Lionel Landwerlin cea113c977 vulkan/runtime: don't lookup the pipeline disk cache if disabled
When the Anv pipeline got migrated to the runtime, we gain/lost a bit
of functionality which is that the disk cache is always read
regardless of VK_ENABLE_PIPELINE_CACHE=0.

This change brings the old behavior back.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 591da98779 ("vulkan: Add a common VkPipelineCache implementation")
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19050>
2022-10-14 23:03:16 +00:00
Ryan Houdek b516f59490 vulkan/wsi: Add dep_libudev to idep dependencies
Otherwise users of `idep_vulkan_wsi` won't pull in the udev dependency,
which will cause the linker to fail later on in compiling.

The user of this dependency is lavapipe which would fail to link if this
isn't provided.

Fixes: 4885e63a6d (vulkan/wsi: implement missing wsi_register_device_event)

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19037>
2022-10-14 21:10:29 +00:00
Yonggang Luo 44ccaca41d util/mesa/wide: Rename _SIMPLE_MTX_INITIALIZER_NP to SIMPLE_MTX_INITIALIZER
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18393>
2022-10-14 03:27:41 +00:00
Mike Blumenkrantz 4b6b3f18f2 vk/graphics_state: don't set default sample locations if rast samples is dynamic
dynamic rasterization samples got added late, and I forgot to update this

Fixes: 1deb83fb86 ("vulkan: Add more dynamic multisample states")

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18896>
2022-10-11 06:58:19 +00:00
Jason Ekstrand 650880105e vulkan,lavapipe: Use a tri-state enum for depth clip enable
This should make it a lot more clear how depth clip enables work.
Annoyingly, because of the way they originally worked in Vulkan 1.0,
it's dependent on the depth clamp if the state isn't set in the pipeline
and isn't declared dynamic.  The enum is explicitly set up so that
drivers don't need to be aware of this change unless they already
implement VK_EXT_extended_dynamic_state3.  If depth clamp/clamp are not
dynamic, depth clip will be either TRUE or FALSE which map to 1/0 so the
field can still be treated as a boolean.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
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/18889>
2022-10-07 06:22:32 +00:00
Bas Nieuwenhuizen 0e6d44d14f vulkan/wsi/x11: Fix double free of modifiers.
Breaks radv when modifiers are used.

Fixes: 8775f08bf1 ("vulkan/wsi/x11: Configure images via params passed to wsi_swapchain_init()")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7386
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7398
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-By: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18919>
2022-09-30 23:39:25 +00:00
Jason Ekstrand 092be5a329 vulkan: Add more dynamic color blend states
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18878>
2022-09-29 05:00:10 +00:00
Jason Ekstrand 1deb83fb86 vulkan: Add more dynamic multisample states
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18878>
2022-09-29 05:00:10 +00:00
Jason Ekstrand 1fee04d8ff vulkan: Add dynamic state for tessellation domain origin
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18878>
2022-09-29 05:00:10 +00:00
Jason Ekstrand 9d0ed9cbcc vulkan: Add more dynamic rasterizer state
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18878>
2022-09-29 05:00:10 +00:00
Jason Ekstrand effd9962d9 vulkan: Add a dynamic state for vp.depth_clip_negative_one_to_one
This is the last bit of viewport state that's not dynamic.  Making it
dynamic will help ANV out a bit.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18878>
2022-09-29 05:00:10 +00:00
Jason Ekstrand 10bc2cd3ae vulkan: Rename viewport_state::negative_one_to_one
This makes it a bit clearer what it's for.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18878>
2022-09-29 05:00:10 +00:00
Mike Blumenkrantz 76a4d5ce89 vulkan: Update the XML and headers to 1.3.230
Acked-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18878>
2022-09-29 05:00:10 +00:00
Jason Ekstrand 691ec62452 vulkan: Use altlen when available for array lengths
When the array length is a calculation, the C version of the calculation
is provided in altlen while len often contains LaTeX that we can't do
anything with.  Use altlen when available.  Also, while we're here, wrap
array lengths in parentheses in case they contain math.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18878>
2022-09-29 05:00:10 +00:00
Jason Ekstrand 2044f2910c vulkan/wsi: Add a supports_scanout flag
This flag indicates whether or not the legacy scanout flag is supported.
It defaults to true since that has been the default assumption for the
WSI code up until now.

On NVIDIA hardware, we can't render to linear so, if we don't have
modifiers, we want to automatically fall back to the blit path.  In
theory, we could do this inside the driver but it's a giant pain and
much harder to ensure that the blit only happens as part of
vkQueuePresent().

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
2022-09-28 21:35:12 +00:00
Jason Ekstrand 15fca5ca7e vulkan/wsi: Add a typedef for memory type select callbacks
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
2022-09-28 21:35:12 +00:00
Jason Ekstrand 39f81564ab vulkan/wsi: Don't expose as many image configure helpers
Now that everything is going through the params-based ones, we don't
need to expose the individual ones.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
2022-09-28 21:35:12 +00:00
Jason Ekstrand 43c1c2b888 vulkan/wsi: Always configure images in wsi_swapchain_init()
Now that all the back-ends are converted, we can drop all the extra code
we had for supporting both paths.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
2022-09-28 21:35:12 +00:00
Jason Ekstrand 5424049e66 vulkan/wsi/win32: Configure images via params passed to wsi_swapchain_init()
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
2022-09-28 21:35:12 +00:00
Jason Ekstrand 76d15717e3 vulkan/wsi/display: Configure images via params passed to wsi_swapchain_init()
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
2022-09-28 21:35:12 +00:00
Jason Ekstrand c315e20d61 vulkan/wsi/wayland: Configure images via params passed to wsi_swapchain_init()
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
2022-09-28 21:35:12 +00:00
Jason Ekstrand 8775f08bf1 vulkan/wsi/x11: Configure images via params passed to wsi_swapchain_init()
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
2022-09-28 21:35:12 +00:00
Jason Ekstrand 29e3fc8eb1 vulkan/wsi: Support configuring swapchain images as part of swapchain init
The eventual goal here is to move as much of the prime and blit logic
out of the individual window-system back-ends as possible.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
2022-09-28 21:35:12 +00:00
Thomas H.P. Andersen 48889fc68d vulkan: avoid warning about unused function
VK_DEFINE_NONDISP_HANDLE_CASTS defines two functions.
In some cases only one or the other is used. Marking
them both unused here to avoid warnings.

Fixes a clang warning about unused static inlined functions.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18800>
2022-09-25 03:53:15 +00:00
Jason Ekstrand 3ce1db339d vulkan: Add a helper for gathering pipeline robustness
This is useful for implementing VK_EXT_pipeline_robustness because it
automatically gathers all the bits from everywhere for you.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18690>
2022-09-20 23:53:51 +00:00
Jason Ekstrand 10485ee415 vulkan: Record more enabled robustness features
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18690>
2022-09-20 23:53:51 +00:00
Jason Ekstrand c63cb7f4d2 vulkan/runtime: Compact descriptor update templates
Get rid of any zero-sized entries so drivers never even have to think
about this case when using templates.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14780>
2022-09-17 03:32:29 +00:00
Jason Ekstrand 3c24f19fa5 vulkan/runtime: Add a comon vk_descriptor_update_template
We can't actually make the template-based update common efficiently but
we can save everyone a bit of typing by having a common struct.  This is
mostly a direct copy+paste from ANV with a type field added and a couple
comments tweaked.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14780>
2022-09-17 03:32:29 +00:00
Chia-I Wu fe36f763d6 vulkan: update comments to device enumeration callbacks
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18607>
2022-09-15 20:01:29 +00:00
Hans-Kristian Arntzen 3bfda5cc0e vulkan: Update to 1.3.228 headers.
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18610>
2022-09-15 16:55:25 +00:00
Chia-I Wu 3c76091801 vulkan: update ALLOWED_ANDROID_VERSION for api level 33
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18476>
2022-09-13 23:34:58 +00:00
Adam Jackson ed2e3f5871 wsi/x11: Fix the is-visual-supported check
This was sort of well intentioned, but wrong. bits_per_rgb_value is the
number of significant bits in the color (channel) specification, not the
number of bits used to name that color within the pixel. If you have a
depth 24 visual but the colormap is 11 bits deep then each of those
channels selects one of 256 11-bit color values in the output ramp.

The open source drivers mostly don't expose anything like that, but
nvidia does, and we refuse to work. That's silly. Practically speaking
we can probably render to any TrueColor or DirectColor visual that your
X server exposes, since it is probably not going to have visuals for
non-color-renderable formats. Just check the visual class instead.

Likewise when matching formats to visuals, count the bits in the rgb
masks in the visual.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6995
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18381>
2022-09-13 21:52:55 +00:00
Oleksii Bozhenko 949edb7ffa vulkan/wsi: Pass wsi_image_create_info into anv_GetPhysicalDeviceImageFormatProperties2
Signed-off-by: Oleksii Bozhenko <oleksii.bozhenko@globallogic.com>

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18347>
2022-09-12 10:44:38 +00:00
James Park c48c53c21f vulkan: Augment _WIN32 stub comparison
Make current check robust to incremental linking.

Compare JMP targets if the first byte is opcode 0xE9.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18400>
2022-09-08 15:37:11 +00:00
Adam Jackson f70df74e0a wsi/x11: Defer clearing image busy flag for non-shm upload
The image is busy until xcb_put_image returns. This isn't a major worry
at the moment since we're doing the PutImage directly from
vkQueuePresent, but if we moved that to a worker thread the race window
would be a lot easier to hit.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18214>
2022-09-06 17:46:49 +00:00
Jason Ekstrand 6ffbb1abdb vulkan: Dirty VP_VIEWPORTS/SCISSORS when copying viewports/scissors
The only reason why we didn't notice before is because ANV always
re-emits all scissors and viewports if the count changes.

Fixes: fcedb1250b ("vulkan: Add a common data structure for dynamic states")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18160>
2022-09-03 05:41:50 +00:00
Lionel Landwerlin 723ae2368f vulkan: fixup 1.3.226 update
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18397>
2022-09-02 23:45:21 +00:00
Timur Kristóf c315e2e718 vulkan, spirv: Update to Vulkan 1.3.226 and latest SPIR-V headers.
Done using the "khronos-update.py" script, leaving out parts that
are not relevant to Vulkan.

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18366>
2022-09-02 16:18:33 +00:00
Igor Torrente 8c73b37e59 vulkan: Add vk_clock_gettime and vk_time_max_deviation
These two new function are based on {anv,radv}_clock_gettime
and some other common code between radv and anv.

These new functions allow these drivers to share code and
more drivers can use it in the future.

v2: Drop the anv/radv changes in this commit (Yiwei Zhang)
v3: Add #ifndef _WIN32

Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v1)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v1)
Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18281>
2022-09-02 00:54:24 +00:00
Mike Blumenkrantz 6d668cb34d vulkan: initialize a variable
../src/vulkan/runtime/vk_fence.c: In function ‘vk_common_CreateFence’:
../src/vulkan/runtime/vk_fence.c:160:12: warning: ‘fence’ may be used uninitialized [-Wmaybe-uninitialized]
  160 |    *pFence = vk_fence_to_handle(fence);
      |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/vulkan/runtime/vk_fence.c:154:21: note: ‘fence’ was declared here
  154 |    struct vk_fence *fence;

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18119>
2022-09-02 00:13:27 +00:00
Jason Ekstrand faaf4f6c45 vulkan,docs: Add documentation Vulkan command pools
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Jason Ekstrand b825c566bb vulkan: Recycle command buffers in vk_command_pool
This is similar to what RADV and several other drivers have been doing
for quite some time.  It's good to have it common.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Jason Ekstrand 11f3323492 vulkan: Add a common vkAllocateCommandBuffers() implementation
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Jason Ekstrand f2288cca47 vulkan: Add a common vkResetCommandBuffer() implementation
This is little more than a wrapper around a function pointer at present
so it doesn't really gain the driver much to use it.  The new callback
will, however, be put to good use in the next commit.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Jason Ekstrand 44ab076fea vulkan: Add a vk_command_buffer_ops struct
This is the standard pattern in the kernel for providing vfunc tables
for C objects.  We're using it in the pipeline cache code but we're
about to start adding more stuff and so it really helps if we have it
for command buffers as well.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Jason Ekstrand 5c143b132a vulkan: Re-order arguments to vk_command_buffer_init
Most other init functions follow the Vulkan API convention of putting
the parent object first.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Jason Ekstrand f90e2af996 vulkan: Re-order arguments to vk_command_pool_init
Most other init functions follow the Vulkan API convention of putting
the parent object first.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Jason Ekstrand ea9e7ecdc1 vulkan: Add a concept of recycling an object
This is not necessarily a full re-initialization of the object but is
whatever is necessary/expedient for the client to see it as a new object
and not the one it has seen before.  For vk_base_object, this removes
any private data and resets the object name to NULL.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Chia-I Wu 89d49bb9de vulkan/wsi: add cpu tracepoints for internal waits
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18262>
2022-09-01 19:30:13 +00:00
Chia-I Wu 7d5227341c vulkan/wsi: add cpu tracepoints to swapchain functions
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18262>
2022-09-01 19:30:13 +00:00