Commit Graph

986 Commits

Author SHA1 Message Date
Jason Ekstrand f76621f719 vulkan/cmd_queue: Properly support non-array pointer members
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5440
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15325>
2022-03-11 11:36:53 -06:00
Jason Ekstrand 94ea3b9c03 vulkan/cmd_queue: Add a common vk_cmd_enqueue_CmdBindDescriptorSets
In order for this to work, the driver must reference-count pipeline
layouts so we can take a reference while the command is in the queue.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15329>
2022-03-10 21:08:36 +00:00
Jason Ekstrand c1070556a0 vulkan/cmd_queue: Add a driver_free_cb hook
If a driver sets driver_data but not driver_free_cb, driver_data will
get freed along with the command.  If a driver sets driver_free_cb,
driver_data will not get automatically freed but the callback will get
called before the rest of the data structure is freed.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15329>
2022-03-10 21:08:36 +00:00
Jason Ekstrand cc4f0e804e vulkan,lavapipe: Move some enqueue helpers to common code
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>
2022-03-10 15:52:10 +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
Jason Ekstrand 719b949575 vulkan/cmd_queue: Generate enqueue entrypoints
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>
2022-03-10 15:52:10 +00:00
Boris Brezillon 47fc0b39c7 vulkan/cmd_queue: Properly deconstify array of pointers
When manipulating an array of pointers, what we want to desconstify is
the array, not the entry type.

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
Jason Ekstrand 0d5dc6ef6a vulkan/cmd_queue: Stop generating enqueue helpers for INTEL perf queries
They don't return void and they're not used by anyone except the Intel
drivers so there's no point in supporting them.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>
2022-03-10 15:52:10 +00:00
Jason Ekstrand cf8cf8a827 vulkan/cmd_queue: Re-flow MANUAL_COMMANDS
This just makes it all a bit easier to read.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>
2022-03-10 15:52:10 +00:00
Boris Brezillon 290e33ab20 vulkan/cmd_queue: Remove duplicate entries in MANUAL_COMMANDS
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
Louis-Francis Ratté-Boulianne 6bd8a3c7e4 vulkan/runtime: Add a vk_cmd_queue object to vk_command_buffer
This is paving the road for generic secondary command buffer support,
where commands are simply recorded in a software queue and replayed
on the primary command buffer when vkCmdExecuteCommands() is called.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>
2022-03-10 15:52:10 +00:00
Louis-Francis Ratté-Boulianne ad4d2da90a vulkan/cmd_queue: Add an initializer for the vk_cmd_queue object
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>
2022-03-10 15:52:10 +00:00
Boris Brezillon dd0f6cb45b vulkan/cmd_queue: Constify vk_cmd_queue.alloc
The implementation shouldn't modify the allocator.

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
Yogesh Mohan Marimuthu 3332fcd9c0 vulkan/device_select: add has_vulkan11 flag with has_pci_bus flag
In EnumeratePhysicalDevices(), pci bus info is available only in
vulkan version >= 1.1. hence adding has_vulkan11 flag in places
where has_pci_bus is used in EnumeratePhysicalDevices() code flow.

Signed-off-by: Yogesh Mohan Marimuthu <yogesh.mohanmarimuthu@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14535>
2022-03-08 14:23:41 +00:00
Yogesh Mohan Marimuthu 1cc549949d vulkan/device_select: for vulkan 1.0 use vid/did for boot_vga
In device select layer EnumeratePhysicalDevices() function pci
bus information is available only in case of vulkan >= 1.1.
Hence use vid/did to match boot_vga device in case of vulkan 1.0.

Signed-off-by: Yogesh Mohan Marimuthu <yogesh.mohanmarimuthu@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14535>
2022-03-08 14:23:41 +00:00
Michel Zou f1f1b3d7f8 vulkan/wsi: drop unused wsi_create_win32_image
fixes: ed391d2a

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15088>
2022-03-03 06:13:07 +00:00
Dave Airlie 48b3ef625e vulkan/wsi: handle queue families properly for non-concurrent sharing mode.
"queueFamilyIndexCount is the number of queue families having access to the image(s) of the
swapchain when imageSharingMode is VK_SHARING_MODE_CONCURRENT.
pQueueFamilyIndices is a pointer to an array of queue family indices having access to the
images(s) of the swapchain when imageSharingMode is VK_SHARING_MODE_CONCURRENT."

If the type isn't concurrent, don't attempt to access the arrays.

dEQP-VK.wsi.xlib.swapchain.create.exclusive_nonzero_queues on lavapipe.

Fixes: 5b13d74583 ("vulkan/wsi/drm: Break create_native_image in pieces")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15101>
2022-03-02 20:47:16 +00:00
Erik Faye-Lund 5c5243adb7 vulkan/wsi: use buffer-image code-path on Windows
This means we no longer map optimal-tiling images in order to display
them on screen, but instead copy via a buffer, which is guaranteed to
linearize.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12210>
2022-02-22 10:04:34 +00:00
Erik Faye-Lund 2e8c119531 vulkan/wsi: add transition to/from transfer-src state
Without these barriers, we'll try to blit from the image when it's in
the incorrect layout, which is illegal.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12210>
2022-02-22 10:04:34 +00:00
Erik Faye-Lund 25a37fabb7 vulkan/wsi: untangle buffer-images from prime
Not all Vulkan implementations allows rendering to linear images, so in
order to support scanning out from these on Windows we might have to copy
through a buffer like we do in the PRIME path.

To avoid reimplementing the same, let's instead generalize the code a
bit so it doesn't have to specfy any PRIME-specific details.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12210>
2022-02-22 10:04:34 +00:00
Boris Brezillon 32c2db1b25 vulkan/wsi: Don't open-code vk_format_get_blocksize()
We already have a standard helper to retrieve the texel block size from
a VkFormat, let's use it instead of adding a new helper.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Suggested-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12210>
2022-02-22 10:04:34 +00:00
Boris Brezillon 7c1c6606d0 vulkan/wsi: Use ALIGN_POT() instead of open-coding it
align_u32() and ALIGN_POT() are doing the same thing.
Replace align_u32() calls by ALIGN_POT() ones and get rid
of align_u32().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Suggested-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12210>
2022-02-22 10:04:34 +00:00
Erik Faye-Lund 83938a1bb3 vulkan/wsi: pass win32-swapchain directly
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12210>
2022-02-22 10:04:34 +00:00
Jason Ekstrand 818c5dedf4 vulkan: Add back vk_image_view::format
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15007>
2022-02-16 00:14:50 +00:00
Jason Ekstrand 05e9e7767d vulkan: Rename vk_image_view::format to view_format
When I originally added vk_image_view, I was overly clever when it came
to the format field.  I decided to make it only contain the bits of the
format contained in the selected aspects.  However, this is confusing
(not generally a good thing) and it's also not always what you want.
The Vulkan 1.3.204 spec says:

    "When using an image view of a depth/stencil image to populate a
    descriptor set (e.g. for sampling in the shader, or for use as an
    input attachment), the aspectMask must only include one bit, which
    selects whether the image view is used for depth reads (i.e. using a
    floating-point sampler or input attachment in the shader) or stencil
    reads (i.e. using an unsigned integer sampler or input attachment in
    the shader). When an image view of a depth/stencil image is used as
    a depth/stencil framebuffer attachment, the aspectMask is ignored
    and both depth and stencil image subresources are used."

So, while the restricted format makes sense for texturing, it doesn't
for when the image is being used as an attachment.  What we probably
actually want is both versions of the format.  We'll call the one given
by the VkImageViewCreateInfo vk_image_view::format and the restricted
one vk_image_view::view_format.

This is just the first commit which switches format to view_format so
the compiler will make sure we get them all.  The next commit will
re-add vk_image_view::format but this time unmodified.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15007>
2022-02-16 00:14:50 +00:00
Simon Ser ffdac8bfa7 vulkan/wsi/wayland: ensure added formats have flags
A format needs to be either alpha or opaque, but can't be neither.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14874>
2022-02-15 09:13:21 +00:00
Simon Ser 5617d5c885 vulkan/wsi/wayland: de-duplicate wsi_wl_display_add_wl_shm_format
Re-use wsi_wl_display_add_drm_format_modifier from
wsi_wl_display_add_wl_shm_format instead of maintaining two
separate switches for DRM and shm formats.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14874>
2022-02-15 09:13:21 +00:00
Simon Ser 1bdf350197 vulkan/wsi/wayland: introduce wsi_wl_display_add_vk_format_modifier
This is a helper to avoid repetitive code in
wsi_wl_display_add_drm_format_modifier.

No functional changes, just refactoring.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14874>
2022-02-15 09:13:21 +00:00
Simon Ser 8ac42a3b1b vulkan/wsi/wayland: switch from alpha/opaque bools to bitfield
This makes the numerous wsi_wl_display_add_vk_format calls easier
to follow: "ALPHA" is easier to decode than "true, false".

No functional changes, just refactoring.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14874>
2022-02-15 09:13:21 +00:00
Jason Ekstrand 37f3da90dd vulkan: Implement of a bunch of VkCommandPool functions
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:25 +00:00
Jason Ekstrand f424d1e9ab vulkan/queue: Assert command buffers have the right queue family
We've got enough information in common code to track this now so we may
as well throw in a helpful assert.

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:25 +00:00
Jason Ekstrand bda4c4f6b6 vulkan: Take a vk_command_pool in vk_command_buffer_init()
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:25 +00:00
Jason Ekstrand a10b6d1c6f vulkan: Add a common vk_command_pool base struct
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
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
Jason Ekstrand 4c61c8a0b8 vulkan,lavapipe: Simplify command recording code-gen
The Entrypoint class already has utilities for gettingt he parameter
list as either declarations or as comma-separated argument names for a
call.  Use that instead of hand-rolling it.  The only modification we
need to make is to add the ability to start the list somewhere other
than at the beginning.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14919>
2022-02-08 19:50:57 +00:00
Mike Blumenkrantz 8335fdfeaf vk/sync: add asserts for timeline semaphore count matching
spec requires that the number of timeline waits/signals matches the
base number of waits/signals if there are any timeline semaphores
being processed by the submit, so asserting here is in line with what
validation will yield

failure to match these will also hang every driver I've tested, so asserting
here potentially saves some people their desktop session

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14741>
2022-02-08 04:09:13 +00:00
Erik Faye-Lund 3abe9ccbd4 vulkan/util: simplify multialloc init
The syntax we're using doesn't work when included into C++ sources. So
let's make it C++ compabible.

It turns out, nobody needs this extra definition which is what's causing
issues. Let's just make the initializer trivial without casting the
struct.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14850>
2022-02-04 10:16:42 +00:00
Erik Faye-Lund 0d0ecbd987 vulkan/util: Add explicit casts to make c++ happy
We're about to need including this header from a C++ source, so let's
add some explicit casts for C++ compatibility.

In one case we can make things a bit cleaner by moving the
char-pointer-ism to the place that needs it, so let's clean that up
while we're at it.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14850>
2022-02-04 10:16:42 +00:00
Erik Faye-Lund 676c65d8d5 vulkan/util: Add extern "C" to allow inclusion from c++
We're about to need including this header from a C++ source, so let's
wrap the whole thing in extern "C".

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14850>
2022-02-04 10:16:42 +00:00
Simon Ser 713a4363e5 vulkan/wsi/wayland: remove format switch from wl_shm_format_for_vk_format
Instead of maintaining two similar switches (one for DRM formats,
one for wl_shm formats), only maintain a single switch (for DRM)
and convert DRM formats to enum wl_shm_format. This reduces the
risk to have inconsistencies between these two functions.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14634>
2022-02-01 08:00:22 +00:00
Simon Ser 5a82232e5c vulkan/wsi/wayland: use DRM_FORMAT_INVALID
Instead of using the magic value 0, use the define.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14634>
2022-02-01 08:00:22 +00:00
Simon Ser fda2aecb8b vulkan/wsi/wayland: use enum wl_shm_format
libwayland defines an enum for wl_shm formats. Let's use it instead
of uint32_t.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14634>
2022-02-01 08:00:22 +00:00
Jason Ekstrand 27042d135e vulkan/wsi: Add image create and bind helpers
These are needed to properly implement the Vulkan 1.1 swapchain image
create/bind functionality.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:55 +00:00
Jason Ekstrand ca791f5c5d wsi/common: Set VK_IMAGE_CREATE_ALIAS_BIT
With Vulkan 1.1, we have a VkImageSwapchainCreateInfoKHR struct which
lets you create a new VkImage which aliases a swapchain image.  However,
there is no corresponding swapchain create flag so we have to set
VK_IMAGE_CREATE_ALIAS_BIT all the time.

We need to do a bit of work in ANV to prevent it from asserting the
moment it sees one of these.  Fortunately, they're already safe because
WSI images go through a different bind path for
VkBindImageMemorySwapchainInfoKHR.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:55 +00:00
Jason Ekstrand 1abab1a28f vulkan/wsi/drm: Drop wsi_create_native/prime_image
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:55 +00:00
Jason Ekstrand ed391d2a46 vulkan/wsi/win32: Break create_win32_image in pieces
This is similar to the previous two commits that we did for DRM native
images.  It breaks it into configure/create/bind and calls
wsi_create_image to walk through the three-step process.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:55 +00:00
Jason Ekstrand d7ad73d6b7 vulkan/wsi/win32: Delete unnecessary copy+paste from DRM
The Win32 WSI just does a copy into the window on the CPU.  There's no
need for external memory or modifiers or implicit sync or any of that.
While we're at it, rename to create_win32_image.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:55 +00:00
Jason Ekstrand d95e3fd98c vulkan/wsi/display: Split image creation
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:55 +00:00
Jason Ekstrand b626a5be43 vulkan/wsi/wayland: Split image creation
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:55 +00:00
Jason Ekstrand d67250d444 vulkan/wsi/x11: Split image creation
Store the wsi_image_create_info in the swapchain and call
wsi_configure_*_image once per swapchain and then use wsi_create_image
for each image.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:54 +00:00
Jason Ekstrand 579578f10a vulkan/wsi/drm: Break create_prime_image in pieces
This is similar to the previous two commits that we did for DRM native
images.  It breaks it into configure/create/bind/finish and calls
wsi_create_image to walk through the process.  The primary difference is
that prime images need fifth step in the process to set up the blit
command buffer.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:54 +00:00
Jason Ekstrand 830d9967db vulkan/wsi: Add a helper for the configure/create/bind pattern
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:54 +00:00
Jason Ekstrand 5b13d74583 vulkan/wsi/drm: Break create_native_image in pieces
Instead of making create_native_image one monolithic function, break it
into a configure stage and a create stage.  The configure stage is
further broken up, first into a common piece that constructs a simple
VkImageCreateInfo and a couple chain-ins.  The second adds the extra
stuff for create_native_image.  This is to prepare for eventually
storing those structs in the swapchain itself.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:54 +00:00
Jason Ekstrand 8299d5f37f vulkan/wsi: Set MUTABLE_FORMAT_BIT in the prime path
Fixes: 4bdf8547f4 "vulkan/wsi: Implement VK_KHR_swapchain_mutable_format"

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>
2022-01-31 19:46:54 +00:00
Caleb Callaway 7483c40ba0 vulkan/overlay: revise and reformat README
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14784>
2022-01-31 19:09:56 +00:00
Georg Lehmann cbe4943ae9 vulkan/wsi/wayland: Fix add_drm_format_modifier aplha/opaqueness.
This had the opposite problem of the shm path. R8G8B8A8 was always support if
either DRM_FORMAT_XBGR8888 or DRM_FORMAT_ABGR8888 was supported, but we need
both.

Fixes: d944136f36 ("vulkan/wsi/wayland: don't expose surface formats not fully supported")

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14588>
2022-01-31 17:50:01 +00:00
Georg Lehmann 9843fddfff vulkan/wsi/wayland: Add modifiers for RGB formats.
These formats get overwritten after the FALLTHROUGH, so no modifers got added
to them at all.

Fixes: 151b65b211 ("vulkan/wsi/wayland: generalize modifier handling")

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14588>
2022-01-31 17:50:01 +00:00
Georg Lehmann a881b6ac1f vulkan/wsi/wayland: Convert missing vulkan formats to shm formats.
Fixes: 6b36f35734 ("vulkan/wsi/wl: add wl_shm support for lavapipe.")

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14588>
2022-01-31 17:50:01 +00:00
Georg Lehmann 4ae4e04e18 vulkan/wsi/wayland: Fix add_wl_shm_format alpha/opaqueness.
We need both the SHM format with alpha and the opaque format to fully support
a vulkan format with alpha. Previously no surface format was reported because
the vulkan formats with aplha were never added as opaque.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5879
Fixes: d944136f36 ("vulkan/wsi/wayland: don't expose surface formats not fully supported")

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14588>
2022-01-31 17:50:01 +00:00
Ella Stanforth a53fd9b089 vulkan: Allow RegisterDisplayEventEXT before first page flip
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14685>
2022-01-31 12:49:26 +00:00
Emma Anholt bdb8e615d1 vulkan: Fix leak of error messages
Fixes: 0cad3beb2a ("vulkan/log: Add common vk_error and vk_errorf helpers")
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14235>
2022-01-27 23:47:46 +00:00
Chia-I Wu 4f1cf6fd3b vulkan/wsi/x11: fix x11_image_init return value on errors
fail_pixmap is reached when xshmfence alloc/map fails.  result is
VK_SUCCESS and we need to pick an error code explicitly.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14748>
2022-01-27 22:06:19 +00:00
Roman Gilg 6018d5c44a vulkan/wsi/x11: document implementation
To extend the shared understanding of our code base and ease contributing
document purpose and flow for many of our internal functions.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6536>
2022-01-27 09:14:29 +00:00
Jason Ekstrand cc8eb6f5df vulkan/runtime: Implement 1.3 features/properties
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
2022-01-25 15:57:53 +00:00
Samuel Pitoiset 6a3928615b vulkan: Update the XML and headers to 1.3.204
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14707>
2022-01-25 15:57:53 +00:00
Michel Dänzer a429b3dd33 Revert "wsi/x11: Avoid a class of deadlocks in the WSI queue thread"
This reverts commit 272fba8e75.

Multiple regressions have been reported against this. Let's revert and
maybe try again.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5910
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5913
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14710>
2022-01-25 14:55:12 +00:00
Thomas H.P. Andersen 23135aece1 vulkan/vk_extensions_gen: fix -Wextern-initializer warning
vk_android_allowed_device_extensions is already declared as
extern in vk_extensions.h

Fixes a warning with clang

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14654>
2022-01-25 00:26:45 +00:00
Mike Blumenkrantz 3dcf275786 vulkan/wsi: add VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT for swapchain image caps
I need this, and drivers can do it, so add it

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14641>
2022-01-24 21:53:21 +00:00
Bas Nieuwenhuizen ce95871a50 vulkan/wsi/display: Add common implementation of VK_EXT_display_control.
Based on the new vk_sync functions.

Copied the version from anv as that seemed more thorough by using the
temporary sync payload. However that does mean we have do use the vk_sync
functions instead of being able to layer it on top of the dispatch table.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14365>
2022-01-24 12:57:35 +00:00
Adam Jackson 272fba8e75 wsi/x11: Avoid a class of deadlocks in the WSI queue thread
Here are two facts, each mildly unpleasant, quite nasty taken together:

- xcb_wait_for_special_event retries its poll() if the fd woke up but
  no matching event arrived, without verifying that the special event
  queue is still registered.
- Present gives no in-band notification of window destruction.

Now if the window is destroyed before the swapchain we're in trouble.
Our WSI thread might be stuck in xcb_wait_for_special_event as we're
awaiting a completion that won't come (the pixmap was being presented as
the window, and then the window was destroyed, so no more events can
happen on that window).

The solution is to use xcb_poll_for_special_event, which is
non-blocking, and handle the appropriate edge cases. If we've run the
event queue but we still don't have an image to acquire, we poke the X
server with a request that gently verifies that the window exists,
allowing the thread to exit gracefully in the above case.  We detect
when we're busy-looping, and poll on the X connection for up to 1ms in
response to avoid burning the CPU.

Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13564>
2022-01-21 19:46:14 +00:00
Samuel Pitoiset 6619f855d9 vulkan/runtime: fix accessing NULL pointers detected by UBSAN
Fixes: 7a84314c12 ("vulkan/runtime: Add sparse bind support.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14619>
2022-01-19 16:16:08 +00:00
Chia-I Wu e6d7e1ec63 vulkan/wsi: add wsi_common_get_image
This can be useful with VkBindImageMemorySwapchainInfoKHR.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14544>
2022-01-14 17:41:42 +00:00
Danylo Piliaiev fa75b2a027 vulkan/wsi: create a common function to compare drm devices
Effectively moves most of v3dv_wsi_can_present_on_device to the
common code to be used in other drivers.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11091>
2022-01-14 12:19:57 +00:00
Alejandro Piñeiro 821c66e50c vulkan: return default string for undefined enum
Instead of a unreachable.

This would avoid an assert on debug builds that uses vkfoo_to_str to
print structure types. This will become more common as some tests will
start to use VK_STRUCTURE_TYPE_MAX_ENUM to mark structures from
unsupported extensions more often.

v2 (Jason):
   * Include enum name on the default message
   * Handle MAX_ENUM as a special case

v3 (Jason):
   * vk_ObjectType_to_ObjectName don't need to use ${enum.name}

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14525>
2022-01-14 10:31:15 +00:00
Hyunjun Ko 58aa920706 vulkan: fix typo
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14105>
2022-01-13 04:01:44 +00:00
Caleb Callaway 64a51293c8 vulkan/overlay: support Vulkan 1.2
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5602
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14465>
2022-01-13 02:02:14 +00:00
Pierre-Eric Pelloux-Prayer 7bd5aa111c vulkan/wsi: add a private transfer pool to exec the DRI_PRIME blit
The idea is to offer the driver a way to execute on a different queue
than the one the app is using for Present.

For instance, this could be used to make the DRI_PRIME blit asynchronous,
by using a transfer queue.

So instead of creating a command buffer to be executed on present using
the supplied queue, this commit uses an internal transfer queue to perform
the blit.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13959>
2022-01-11 12:18:35 +00:00
Pierre-Eric Pelloux-Prayer 0ad7ec56c9 vulkan/wsi: add use_prime_blit param to wsi_swapchain_init
Instead of initializing it to false and overriding it later if
needed.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13959>
2022-01-11 12:18:35 +00:00
Bas Nieuwenhuizen 85ca7fab29 radv: Add common entrypoint dependency.
To ensure we have the header. The revert likely reintroduced compilation flakiness due
to missing dependencies.

Fixes: a255f6f823 ("radv: do not use the common entrypoint for the Metro Exodus layer")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14430>
2022-01-07 02:21:36 +00:00
Jason Ekstrand b2073f5e5d radv: Move QueueSignalReleaseImageANDROID to common code
This is mostly a copy+paste job but with a few syntax changes to make it
follow more closely with other common Vulkan code.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14372>
2022-01-05 16:36:10 +00:00
Jason Ekstrand dfb1e1777c anv,radv,v3dv: Move AcquireImageANDROID to common code
All three implementations are identical.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14372>
2022-01-05 16:36:10 +00:00
Bas Nieuwenhuizen 7a84314c12 vulkan/runtime: Add sparse bind support.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:18 +00:00
Bas Nieuwenhuizen 73cdc302ab vulkan/runtime: Refactor queue submit to take an argument struct.
For merging with the sparse binding structs.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
2021-12-31 15:14:18 +00:00
Jason Ekstrand 88b9b68f30 vulkan/runtime: Validate instance version on 1.0 implementations
This isn't something that ANV or RADV have cared about in a long time
but, as people bring up new Vulkan drivers, shipping Vulkan 1.0 is still
a thing that happens in Mesa.  The common code should also implement the
1.0 rules.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14150>
2021-12-20 16:45:55 +00:00
Lionel Landwerlin b00086d393 anv,wsi: simplify WSI synchronization
Rather than using 2 vfuncs, use one since we've unified the
synchronization framework in the runtime with a single vk_sync object.

v2 (Jason Ekstrand):
 - create_sync_for_memory is now in vk_device

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14237>
2021-12-17 00:55:31 +00:00
Jason Ekstrand 2188829d29 vulkan/queue: Handle WSI memory signal information
We handle it by asking the driver to create a vk_sync that wraps a
VkDeviceMemory object and gets passed as one of the signal ops.

Fixes: 9bffd81f1c ("vulkan: Add common implementations of vkQueueSubmit and vkQueueWaitIdle")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14237>
2021-12-17 00:55:31 +00:00
Lionel Landwerlin cdf101455d vulkan: fix missing handling of WSI memory signal
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: b996fa8efa ("anv: implement VK_KHR_synchronization2")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5744
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14237>
2021-12-17 00:55:31 +00:00
Tomeu Vizoso f71713d43c lvp: Free the driver_data pointer for all commands
We were only freeing it for commands that had a struct as their
parameter, but all commands can have driver_data.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5715
Reported-by: Jose Fonseca <jfonsec@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14081>
2021-12-14 09:46:39 +01:00
Jakob Bornecrantz 555f93cdcd vulkan-device-select: Don't leak drmDevicePtr
ASAN found a leak:

```
Direct leak of 1440 byte(s) in 10 object(s) allocated from:
    #0 0x4a9a92 in calloc (build-Monado-CMake/src/xrt/targets/service/monado-service+0x4a9a92)
    #1 0x7fdf82afed06 in drmDeviceAlloc build-drm/../drm/xf86drm.c:3933:14
    #2 0x7fdf82b00203 in drmProcessPciDevice build-drm/../drm/xf86drm.c:3965:11
    #3 0x7fdf82b00203 in process_device build-drm/../drm/xf86drm.c:4359:16
    #4 0x7fdf82b0485e in drmGetDevice2 build-drm/../drm/xf86drm.c:4528:15
    #5 0x7fdf70751113 in device_select_find_xcb_pci_default ../src/vulkan/device-select-layer/device_select_x11.c:95:13
    #6 0x7fdf70751113 in get_default_device ../src/vulkan/device-select-layer/device_select_layer.c:395:21
    #7 0x7fdf70751113 in device_select_EnumeratePhysicalDevices ../src/vulkan/device-select-layer/device_select_layer.c:456:33
```

Cc: mesa-stable
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14068>
2021-12-06 11:21:03 +00:00
Yonggang Luo 6e7ffa760f vulkan: Open registry XML files as UTF-8
"C:\CI-Tools\msys64\mingw64\bin/python3.EXE" "../../src/vulkan/util/gen_enum_to_str.py" "--xml" "../../src/vulkan/registry/vk.xml" "--outdir" "C:/work/xemu/xemu-opengl/mesa/build/windows-mingw64/src/vulkan/util"
Traceback (most recent call last):
  File "C:\work\xemu\xemu-opengl\mesa\src\vulkan\util\gen_enum_to_str.py", line 473, in <module>
    main()
  File "C:\work\xemu\xemu-opengl\mesa\src\vulkan\util\gen_enum_to_str.py", line 462, in main
    f.write(template.render(
UnicodeEncodeError: 'gbk' codec can't encode character '\xa9' in position 107: illegal multibyte sequence

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/14015>
2021-12-05 03:28:38 +08:00
Sergii Melikhov 7fb6eafbc4 vulkan: Unlock before return.
Fix defect reported by Coverity Scan CID-1494382.

Missing unlock (LOCK): Returning without unlocking queue->submit.mutex.

Fixes: 9bffd81f1c ("vulkan: Add common implementations of vkQueueSubmit and vkQueueWaitIdle")

Signed-off-by: Sergii Melikhov <sergii.v.melikhov@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13933>
2021-11-24 15:15:46 +00:00
Michel Zou d7957df318 vulkan: fix uninitialized variables
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13892>
2021-11-23 19:11:05 +00:00
Alejandro Piñeiro ff89dc3523 vulkan: move common format helpers to vk_format
v3dv, radv, and turnip are using several C&P format helpers (most of
them wrappers over util_format_description based helpers).  methods.

This commit moves the common helpers to the already existing common
vk_format.h. For the case of v3dv we were able to remove the vk_format
header. For turnip and radv, a local vk_format.h header remains, with
methods that are only used for those drivers.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13858>
2021-11-19 12:23:19 +01:00
Joshua Ashton d0f217ad80 vulkan: Update the XML and headers to 1.2.199
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13820>
2021-11-18 01:05:06 +00:00
Jason Ekstrand 63baeffc2d vulkan/sync: Rework asserts a bit
ANV currently smashes off the TIMELINE bit depending on whether or not
the i915 interface supports them, triggering assert(!type->get_value).
Instead of requiring ANV to smash off function pointers, let the extra
function pointers through and then assert on the feature bits before the
function pointers get used.  This should give us roughly the same amount
of assert protection while side-stepping the feature disabling problem.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13839>
2021-11-17 16:52:29 +00:00
Jason Ekstrand 8a11d2a31b vulkan: Add a dummy sync type
This is useful in WSI scenarios where you want to trivially signal a
fence or semaphore.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:54:27 -06:00
Jason Ekstrand 2a910071bc vulkan,anv: Auto-detect syncobj features
Instead of having a bunch of const vk_sync_type for each permutation of
vk_drm_syncobj capabilities, have a vk_drm_syncobj_get_type helper which
auto-detects features.  If a driver can't support a feature for some
reason (i915 got timeline support very late, for instance), they can
always mask off feature bits they don't want.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:54:27 -06:00
Jason Ekstrand c5ac1d1669 vulkan: Add an emulated binary vk_sync type
This wraps a timeline vk_sync type and turns it into a binary one.  This
is useful for, for instance, driver layered on D3D12.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:54:27 -06:00
Jason Ekstrand e3fda7ae78 vulkan/wsi/display: Wrap wsi_display_fence in a vk_sync
This gets rid of the bespoke vfunc interface in the WSI code.
Eventually, I'd love to get rid of wsi_display_fence entirely but
this at least makes it a lot more palatable.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:54:27 -06:00
Jason Ekstrand b1addc425a wsi/display: Rework wsi_fence a bit
Get rid of most of the guts of the base class and just leave it as a
vtable.  We can also drop some of wsi_display_fence.  One functional
change here is that we're now using VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE
which is more correct anyway because, thanks to the funky reference
counting we do with destroyed and event_received, its lifetime is tied
to the physical device, at best.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:54:27 -06:00
Jason Ekstrand 2bd3434fa2 vulkan/wsi: Drop wsi_common_get_current_time()
Use os_time_get_nano() instead.  At this point, it's just a wrapper
around os_time_get_nano() anyway.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:54:27 -06:00
Jason Ekstrand 7b19c9d19b vulkan/device: Log the timeline mode when lost
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:54:27 -06:00
Jason Ekstrand 9bffd81f1c vulkan: Add common implementations of vkQueueSubmit and vkQueueWaitIdle
This adds a new vk_queue_submit object which contains a list of command
buffers as well as wait and signal operations along with a driver hook
which takes a vk_queue and a vk_queue_submit and does the actual submit.
The common code then handles spawning a submit thread if needed, waiting
for timeline points to materialize, dealing with timeline semaphore
emulation via vk_timeline, etc.  All the driver sees are vk_queue.submit
calls with fully materialized vk_sync objects which it can wait on
unconditionally.

This implementation takes a page from RADV's book and only ever spawns
the submit thread if it sees a timeline wait on a time point that has
not yet materialized.  If this never happens, it calls vk_queue.submit
directly from vkQueueSubmit() and the thread is never spawned.

One other nicety of the new framework is that there is no longer a
distinction, from the driver's PoV, between fences and semaphores.  The
fence, if any, is included as just one more signal operation on the
final vk_queue_submit in the batch.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:54:27 -06:00
Jason Ekstrand 673b5e97ec vulkan: Add a common implementation of VkSemaphore
This is built on the new vk_sync primitives.  In the vk_physical_device,
the driver provides a null-terminated array of vk_sync_type pointers in
priority order.  The semaphore implementation then selects the first
type that meets the necessary criterion.  In particular, semaphores may
or may not be timelines depending on the VkSemaphoreType.  It also
auto-selects the semaphore type based on the external handle types
provided and can down-grade as needed to support a particular external
handle.

The implementation itself is mostly copy+pasted from ANV.  The primary
difference is the fact that anv_semaphore_impl has been replaced with
vk_sync.  The permanent vk_sync is still embedded (like ANV) but the
temporary one is a pointer.  This makes stealing the temporary state as
part of VkQueueSubmit a bit easier.

All of the interesting stuff around waits, signals, etc. is implemented
by the vk_sync interface.  All this code does is wrap it all in the
annoyingly detailed VkFence rules so we can provide the correct Vulkan
entrypoint behavior.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:54:27 -06:00
Jason Ekstrand 60e7359db0 vulkan: Add a common implementation of VkFence
This is built on the new vk_sync primitives.  In the vk_physical_device,
the driver provides a null-terminated array of vk_sync_type pointers in
priority order.  The fence implementation then selects the first type
that meets the necessary criterion.  In particular, fences can't be
timelines and need to support reset and CPU wait.  It also auto-selects
the fence type based on the external handle types provided and can
down-grade as needed to support a particular external handle.

The implementation itself is mostly copy+pasted from ANV.  The primary
difference is the fact that anv_fence_impl has been replaced with
vk_sync.  The permanent vk_sync is still embedded (like ANV) but the
temporary one is a pointer.  This makes stealing the temporary state as
part of VkQueueSubmit a bit easier.

All of the interesting stuff around waits, resets, etc. is implemented
by the vk_sync interface.  All this code does is wrap it all in the
annoyingly detailed VkFence rules so we can provide the correct Vulkan
entrypoint behavior.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Jason Ekstrand 301e20f7a3 vulkan: Add an emulated timeline sync type
This is mostly copy+paste (and a bit of re-typing) from ANV.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Jason Ekstrand 13ab3757bb vulkan: Add a common vk_drm_syncobj struct
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Jason Ekstrand fdb636e3a6 vulkan/vk_device: Add a drm_fd field
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Jason Ekstrand 95dee5150a vulkan/util: Include stdlib.h
It's needed for malloc() which is used by STACK_ARRAY

Fixes: f695171e38 ("vulkan: add common entrypoints for sparse image requirements/properties")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Jason Ekstrand 8134feb9a2 vulkan/meson: Re-arrange libvulkan_util deps a bit
Rename files_vulkan_runtime to vulkan_runtime_files and add a new
vulkan_runtime_deps array for dependencies.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Jason Ekstrand 3cf5fced4c vulkan: Add a vk_sync base class
This doesn't map directly to any particular Vulkan object but is,
instead, a base class for the internal implementations of both VkFence
and VkSemaphore.  Its utility will become evident in later patches.

The design of vk_sync will look familiar to anyone with significant
experience in DRM.  The base object itself is just a pointer to a vfunc
table with function pointers providing the implementation of the various
operations.  Depending on how the vk_sync will be used some of of those
vfuncs are optional.  If it's only going to be used for VkSemaphore, for
instance, there's no need for reset().

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Jason Ekstrand e9662e0154 vulkan/device: Add a check_status hook
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Jason Ekstrand dd89ef96d7 vulkan: Pull the device lost framework from ANV
It's a bit on the over-complicated side but the objective is to make the
debug log messages show up in the same thread as the first
VK_ERROR_DEVICE_LOST so we don't massively confuse the app.  It's
unknown if this is actually ever a problem but, with submit happening
off on its own thread, logging errors from threads the client doesn't
know about doesn't seem like a massively great plan.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
2021-11-16 10:02:08 -06:00
Danylo Piliaiev deb23612f7 vulkan/util: Handle depth-only formats in vk_att_ref_stencil_layout
From VUID-VkAttachmentReference2-attachment-04755:
 "If attachment is not VK_ATTACHMENT_UNUSED, and the format of the
  referenced attachment is a depth/stencil format which includes both
  depth and stencil aspects, and layout is
  VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or
  VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, the pNext chain must include
  a VkAttachmentReferenceStencilLayout structure."

We did not check that there even could be a stencil layout
before fetching it.

Fixes a few tests from:
 dEQP-VK.image.depth_stencil_descriptor.depth_read_only_optimal.*

Fixes: 979ea394e5 "vulkan/util: Move
helper functions for depth/stencil images to vk_iamge"

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13740>
2021-11-11 17:17:16 +00:00
Niklas Haas a697dde553 wsi/x11: support depth 30 visuals
There's only really one format that makes sense here, since there's no
sRGB equivalent for 10-bit packed formats.

It's possible that this results in flipped colors, if 10-bit visuals
exist that have the channels in the opposite order. (They don't seem to,
on my end)

Perhaps a more principled solution would also compare the exact r/g/b
bitmasks. But for now, this works.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3537
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9450>
2021-11-10 15:53:11 +00:00
Vinson Lee 794a9cf3d6 vulkan/wsi: Unlock before return on error path.
Fix defect reported by Coverity Scan.

Missing unlock (LOCK)
missing_unlock: Returning without unlocking wsi->wait_mutex.

Fixes: 4885e63a6d ("vulkan/wsi: implement missing wsi_register_device_event")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13698>
2021-11-10 13:22:24 +00:00
James Park 183e705a15 vulkan, radv: Support backslash in ICD paths
Vulkan loader wants backslash for paths on Windows. Need to jump through
hoops because Meson does not support backslashes in commands.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13461>
2021-11-10 09:48:41 +00:00
Hyunjun Ko 979ea394e5 vulkan/util: Move helper functions for depth/stencil images to vk_iamge
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12785>
2021-11-09 16:12:04 +00:00
Dave Airlie 40157bc2b0 vulkan: add new image types undef beta define to switch statements.
This fixes some warnings when building with beta extensions enabled.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13685>
2021-11-09 04:33:06 +00:00
Tapani Pälli 4885e63a6d vulkan/wsi: implement missing wsi_register_device_event
These changes implement vkRegisterDeviceEventEXT and detection of
monitor hotplug. Wsi launches a thread that listens to udev events and
signals the appropriate device fences when hotplug hapens.

v2: use wsi fences instead of syncobj api (Jason Ekstrand)
v3: refactor + cleanups, create thread on demand (Samuel Pitoiset)
v4: bring back syncobj support from initial version for radv
v5: make libudev dependency optional, check for poll errors (Simon Ser)
v6: change matching mechanism to use udev device node instead of path
v7: remove the matching mechanism
v8: fix a race with thread creation + use single mutex + other cleanups
    (Jason Ekstrand)

Fixes:
   dEQP-VK.wsi.display_control.register_device_event

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12305>
2021-11-04 16:57:29 +00:00
Tapani Pälli 73f21ea2e1 vulkan/wsi: provide api for drivers to setup syncobj fd
Drivers that import sync_fd to the wsi fences can use this to set file
descriptor for syncobj related calls. This fixes permission errors when
registering display/device events and importing sync_fd from driver
side.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12305>
2021-11-04 16:57:29 +00:00
Mike Blumenkrantz dd71cc8947 lavapipe: fix cmd queuing for dynamic render
this sucks, but it should be sorted quickly in #5440

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13627>
2021-11-04 03:22:09 +00:00
Mike Blumenkrantz fbd5ded5e0 vk: update headers for 1.2.197
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13627>
2021-11-04 03:22:08 +00:00
Dave Airlie a8725ec3dc vulkan/wsi: set correct bits for host allocations/exports for images.
Lavapipe was hitting asserts in this area due to incorrect bits being
specified.

Set the handle type depending on the sw flag, and set a correct handle
type for the memory host ptrs.

v2: add image export struct to image creation (Jason)

Fixes: 895d3399f7 ("lavapipe: add support for KHR_external_memory_fd")
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13615>
2021-11-02 10:27:04 +10:00
Jason Ekstrand 4108fda426 vulkan: Move all the common object code to runtime/
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13156>
2021-10-29 23:12:32 +00:00
Jason Ekstrand 4af0c038cf vulkan: Move trampoline code-gen to its own file
This way we sepaprate the raw tables from the code that actively depends
on vk_device and friends.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13156>
2021-10-29 23:12:32 +00:00
Jason Ekstrand d53f20ff4d vulkan: Break entrypoint parsing into its own file
Instead of having a bunch of stuff depend on vk_dispatch_table_gen to
get the list of entrypoints, pull that into its own vk_entrypoints file.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13156>
2021-10-29 23:12:32 +00:00
Jason Ekstrand 8f9e0c2816 vulkan/dispatch_table: EntrypointBase doesn't need to derive from object
We use python3 now and everything derives from object automatically

Suggested-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13156>
2021-10-29 23:12:32 +00:00
Jason Ekstrand 3fd7cc9d42 vulkan: Drop unnecessary [en]coding comments from python generators
Suggested-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13156>
2021-10-29 23:12:32 +00:00
Jason Ekstrand a208b849f3 vulkan: Rework mako error handling in python generators
Suggested-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13156>
2021-10-29 23:12:32 +00:00
Jason Ekstrand 837a142f2d vulkan/vk_extensions_gen: Stop including vk_object.h
All we need from it is vulkan_common.h for VkExtensionProperties.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13156>
2021-10-29 23:12:32 +00:00
Jason Ekstrand 741262ee01 vulkan/vk_extensions_gen: Drop support for extra includes
No one is using this anymore.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13156>
2021-10-29 23:12:32 +00:00
Lionel Landwerlin d944136f36 vulkan/wsi/wayland: don't expose surface formats not fully supported
Depending on whether an application creates a swapchain with
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR or not, we might use 2
different formats with the compositor.

This change makes sure that we support all the underlying formats
before exposing the corresponding VkFormat to the application.

v2: Don't forget get_formats2() (Ivan)

v3: Replace formats with availability boolean (Simon)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 151b65b211 ("vulkan/wsi/wayland: generalize modifier handling")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5522
Reviewed-by: Ivan Briano <ivan.briano@intel.com> (v2)
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13453>
2021-10-26 16:12:06 +03:00
Boris Brezillon 1813bb5917 vulkan: Fix entrypoint generation when compiling for x86 with MSVC
When compiling for x86 with MSVC, Vulkan API entry points follow the
__stdcall convention (VKAPI_CALL maps to __stdcall), which uses the
following name mangling:

   _<function_name>@<arguments_size>

Fix the vk_entrypoint_stub()/alternatename definitions accordingly.

Fixes: 6d44b21d4f ("vulkan: Fix weak symbol emulation when compiling with MSVC")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13516>
2021-10-25 18:31:22 +00:00
Connor Abbott 7a90aa8d2e vk/format, v3dv: Add a vulkan -> pipe swizzle helper
And use it to replace the one in v3dv.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13359>
2021-10-18 16:00:38 +00:00
Jason Ekstrand b79e978ae4 vulkan/wsi/win32: Delete the wrapper entrypoints
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13352>
2021-10-14 15:44:51 +00:00
Jason Ekstrand 116e23e385 vulkan/log: Don't assert on non-client-visible objects
We already have code to deal with non-client-visible objects but we were
asserting if it didn't fall into one of the clearly mappable error
cases.  However, we didn't have a mapping for VK_ERROR_NOT_PERMITTED
which can happen during object creation.  Let's just be sloppy and drop
the assert.  Worst case, the client gets an error with no object.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13341>
2021-10-14 14:23:45 +00:00
Jason Ekstrand 071437d29d vulkan/log: Tweak our handling of a couple error enums
VK_ERROR_INITIALIZATION_FAILED can happen as part of device creation and
isn't really an instance error in that case.
VK_ERROR_EXTENSION_NOT_PRESENT, on the other hand, is always an instance
thing and we should handle it as such.

Fixes: 0cad3beb2a ("vulkan/log: Add common vk_error and vk_errorf helpers")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13341>
2021-10-14 14:23:45 +00:00
Boris Brezillon fd46749234 vulkan: Set unused entrypoints to vk_entrypoint_stub when compiling with MSVC
If we don't do that we hit the assert(entry[i] != NULL) added by commit
6d44b21d4f ("vulkan: Fix weak symbol emulation when compiling with MSVC").

Fixes: 6d44b21d4f ("vulkan: Fix weak symbol emulation when compiling with MSVC")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13355>
2021-10-14 13:56:38 +00:00
Boris Brezillon 6d44b21d4f vulkan: Fix weak symbol emulation when compiling with MSVC
Mapping unimplemented entrypoints to a global function pointer variable
initialized to NULL is a bit cumbersome, and actually led to a bug
in the vk_xxx_dispatch_table_from_entrypoints() template: the !override
case didn't have the right check on the source table entries. Instead of
fixing that case, let's simplify the logic by creating a stub function
and making the alternatename pragma point to this stub. This way we get
rid of all those uneeded xxx_Null symbols/variables and simplify the
tests in vk_xxxx_dispatch_table_from_entrypoints().

Cc: mesa-stable
Fixes: 98c622a96e ("vulkan: Update dispatch table gen for Windows")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13348>
2021-10-14 09:09:23 +02:00
Adam Jackson b01fe97a39 wsi/x11: Fetch and discard the SYNC extension info
Since we're not checking for this, xcb has to do it for us the first
time we call xcb_sync_destroy_fence, which puts a blocking round-trip in
the swapchain destroy path for no reason. Check for the extension so we
have the extension's opcode cached when we need it.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13339>
2021-10-13 16:11:11 +00:00
Jason Ekstrand a00f4c6f7d vulkan/wsi/display: Delete the wrapper entrypoints
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-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/13234>
2021-10-13 00:06:15 +00:00
Jason Ekstrand 8abeecf505 vulkan/wsi/wayland: Delete the wrapper entrypoints
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-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/13234>
2021-10-13 00:06:15 +00:00
Jason Ekstrand 8ade418144 vulkan/wsi/x11: Delete the wrapper entrypoints
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-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/13234>
2021-10-13 00:06:15 +00:00
Jason Ekstrand 1680cd907d vulkan/wsi/common: Delete the wrapper entrypoints
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-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/13234>
2021-10-13 00:06:15 +00:00
Jason Ekstrand 75955c6685 vulkan/wsi: Add common wrappers for most entrypoints
For a long time, our Vulkan WSI code has acted as something of a layer.
The WSI code calls into various Vulkan entrypoints inside the driver to
create images, allocate memory, etc.  It then implements the API-facing
interface almost entirely.  The only thing the driver has to provide is
little wrappers that wrap around the WSI calls to expose them through
the API.

However, now that we have a common dispatch framework, we can implement
entrypoints directly in the WSI code.  As long as the driver uses
vk_instance, vk_physical_device, and vk_device, we can provide common
wrappers for the vast majority of entrypoints.  The only exceptions are
vkAcquireNextImage, vkQueuePresent, vkRegisterDeviceEventEXT, and
vkRegisterDisplayEventEXT because those may have to manually poke at
synchronization primitives.  We provide wrappers for vkAcquireNextImage
and vkQueuePresent because some drivers can use the default versions.

For now, we're intentionally avoiding any link-time dependencies between
WSI and the common code.  We only use VK_FROM_HANDLE and associated
inline helpers and vk_physical_device has a pointer to a wsi_device.
Eventually, we may tie the two together closer, but this lets us get 95%
of the way there without reworking the universe.

Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-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/13234>
2021-10-13 00:06:15 +00:00
Jason Ekstrand 020fbb9ea1 vulkan/wsi: Add a dispatch table for WSI entrypoints
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-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/13234>
2021-10-13 00:06:15 +00:00
Jason Ekstrand 916c9335b4 meson: Add and use an idep for Vulkan WSI
Acked-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13234>
2021-10-13 00:06:15 +00:00
Iván Briano 0b75b88651 vulkan: Generate defines for aliases of promoted enums
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13264>
2021-10-11 18:14:06 +00:00
Iván Briano 1c2cd8bc16 vulkan: fix handling of aliases in enum members
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13264>
2021-10-11 18:14:06 +00:00
Jason Ekstrand 1d4d71057b vulkan: Generate #defines with every bit in a given bitfield
This is useful when trying to restrict from VkFoo2 to VkFoo.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13198>
2021-10-11 10:29:05 -05:00
Jason Ekstrand 2741762ca9 vulkan: Generate flag #defines based on bitwidth
Instead of basing it on a fixed list, just generate #defines for every
bitfield that's 64-bit.  As part of this refactor, we rework things a
bit to record all bitfields and just not do anything with them if
they're not 64-bit.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13198>
2021-10-11 10:28:58 -05:00
Yogesh Mohanmarimuthu 5317874f91 vulkan/device-select: select correct default device for xcb apiVersion 1.0
In function fill_drm_device_info(), struct ext_pci_properties is filled only
if has_vulkan11 is true. But the data received from ext_pci_properties is used
without checking for has_vulkan11. Fixing this by setting
drm_device->has_bus_info also if has_vulkan11 is true.

This fix will help in case of nonidentical gpu being used and xcb_surface
extension enabled.

Signed-off-by: Yogesh Mohanmarimuthu <yogesh.mohanmarimuthu@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12816>
2021-10-08 13:51:33 +00:00
Chia-I Wu 8cce6281e6 util/vector: make util_vector_init harder to misuse
Make u_vector_init a wrapper to u_vector_init_pot.  Let both take
(element_count, element_size) as parameters.

Motivated by eed0fc4caf ("vulkan/wsi/wayland: fix an invalid
u_vector_init call")

v2: rename u_vector_init_pot to u_vector_init_pow2

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13201>
2021-10-08 00:15:11 +00:00
Jason Ekstrand 305b170229 vulkan/device: Use vk_errorf to report missing features
With a tiny bit more code-gen, we can now not only throw the error but
also log back to the client exactly which feature was missing.

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
Jason Ekstrand 5b42f1a374 vulkan/device: Use vk_error
Tested-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/13045>
2021-10-07 20:51:36 +00:00
Jason Ekstrand 330f4c9bc9 vulkan/instance: Use vk_error in vk_instance_init
We have to be a bit careful here.  Calling log functions during instance
initialization can be a bit sketchy.  However, we know that __vk_log_impl
only ever touches the callbacks lists if instance->base.client_visible
so it's safe to call vk_error as soon as we've set up instance_callbacks.

Tested-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/13045>
2021-10-07 20:51:36 +00:00
Jason Ekstrand ad27db2ae9 vulkan/log: Drop _impl from the log helper names
Now that we no longer have every driver in the tree defining their own
__vk_errorf and __vk_errorv, we don't need to worry about the symbol
collision anymore and can use the "real" names for the common ones.

Tested-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/13045>
2021-10-07 20:51:36 +00:00
Jason Ekstrand 0cad3beb2a vulkan/log: Add common vk_error and vk_errorf helpers
These helpers have quite a bit of smarts in them to log errors to chase
the object chain as needed and log errors to roughly the appropriate
object.  For instance, VK_ERROR_OUT_OF_DEVICE_MEMORY always goes to a
device while VK_ERROR_OUT_OF_HOST_MEMORY always goes to the instance.

Tested-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/13045>
2021-10-07 20:51:36 +00:00
Jason Ekstrand ec34ec388b vulkan/log: Handle logging to a physical device
Instance-level objects won't have a device pointer so we can't rely on
that.  Instead, we should look at the object type and try to chase it
back to an instance.  Sadly, we can't do that for certain display and
WSI objects.  However, we never use the vk_log* helpers for those.

Tested-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/13045>
2021-10-07 20:51:36 +00:00
Jason Ekstrand 9067c12d2a vulkan/log: Log to instance messages during instance construction
If the instance isn't client-visible yet (i.e. foo_instance_to_handle
hasn't been called), then the instance is still under construction and
we should log using vk_debug_message_instance.  This makes the vk_log*
macros work regardless of whether the instance is fully constructed or
not.

Tested-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/13045>
2021-10-07 20:51:35 +00:00
Jason Ekstrand e884e35077 vulkan/log: Assert if the driver logs a client-invisible object
Tested-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/13045>
2021-10-07 20:51:35 +00:00
Jason Ekstrand 571b5f5000 vulkan: Track which objects are client-visible
When dealing with debug logging, it's useful to track when an object's
construction is finished and it's now visible to the client.  We can
detect this pretty easily by setting a flag the first time foo_to_handle
is called.  As long as drivers only ever call that function at the end
of object construction (they all do to my knowledge), this should be a
reliable mechanism for detecting when a client knows about a handle.

Tested-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/13045>
2021-10-07 20:51:35 +00:00
Jason Ekstrand a815b2b3c1 vulkan: Drop vk_object_base_reset
It's no longer used and just makes the init/finish path more
complicated.

Tested-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/13045>
2021-10-07 20:51:35 +00:00
Lionel Landwerlin 97f0a4494b vulkan: implement legacy entrypoints on top of VK_KHR_synchronization2
v2: fix common vkQueueSubmit() pNext generation
    fix potential leak of perf_query_submit_info
    fix comment about casting VkQueue to vk_object_base
    add helper for barrier struct upgrades (Jason)
    reuse __vk_append_struct() (Jason)
    optimize vk_common_GetQueueCheckpointDataNV
    use multialloc for vk_common_QueueSubmit (Dave)

v3: Reuse new vk_queue/vk_command_buffer objects
    Fixup CmdWaitEvents() (Jason)

v4: Add comment about dep_flags for CmdWaitEvents() (Jason)

v5: Drop multialloc in VkQueueSubmit entrypoint (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>
2021-10-06 20:22:38 +00:00
Lionel Landwerlin 9af7506370 vulkan/util: generate define for a selected few enums
One of the unfortunate effect of Vulkan starting to use 64bit bitmasks
is that they can no longer be defined using enums because C doesn't
guarantees that enum values will be 64bits.

Vulkan therefore started using those patterns :

  static const VkAccessFlags2KHR VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR = 0x00000001;

This has the effect that we can not longer use those values in
switch/case statements.

This change introduces defines so that we can keep doing this. For now
only VkAccessFlags2KHR/VkPipelineStageFlags2KHR are allowed to be
redefined this way, this list could be changed later (or all bitmask
could be processed this way).

v2: Generate hexadecimal numbers (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>
2021-10-06 20:22:37 +00:00
Lionel Landwerlin dbf4cfeff5 vulkan: remove unused VkCommand
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>
2021-10-06 20:22:37 +00:00
Lionel Landwerlin 59e98694be vulkan: handle new VK_KHR_synchronization2 image layouts
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>
2021-10-06 20:22:37 +00:00
Lionel Landwerlin 2ff3fd4773 vulkan: put generated defines into their own header
v2: Put vk_enum_defines.h in the list of generated files

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>
2021-10-06 20:22:37 +00:00
Dave Airlie 7d388c8d09 wsi/x11: cleanup properly after mit shm paths are used.
This path was being skipped on sw + has_mit_shm, when it
shouldn't be.

Fixes: a069b4e9b9 ("vulkan/wsi/sw: add mit-shm support for pixmap allocation")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13217>
2021-10-07 05:43:27 +10:00
Mike Blumenkrantz 7cc85dba71 build: unify vulkan cpp platform args
these were duplicated all over the place, and it's annoying to have to keep
duplicating them any time a new component includes the vulkan header

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13141>
2021-10-06 14:19:35 +00:00
Dave Airlie ab1c888c8d device_select: close dri3 fd after using it.
This can leak and causes crashes in some CTS test groups
dEQP-VK.wsi.xcb.incremental_present*

Fixes: 9bc5b2d169 ("vulkan: add initial device selection layer. (v6.1)")
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13215>
2021-10-06 18:24:54 +10:00
Jason Ekstrand 7677f1d09e vulkan: Update the XML and headers to 1.2.195
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>
2021-10-06 02:18:39 +00:00
Chia-I Wu eed0fc4caf vulkan/wsi/wayland: fix an invalid u_vector_init call
u_vector_init requires size to be power-of-two.

Fixes: 151b65b211 ("vulkan/wsi/wayland: generalize modifier handling")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13186>
2021-10-05 17:42:41 +00:00
Jason Ekstrand 2f55aace9c vulkan/physical_device_features: Stop generating a header
It only has one entrypoint and nothing in it is based on code-gen.  We
can put that one entrypoint in vk_physical_device.h instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13150>
2021-10-04 22:42:32 +00:00
Jason Ekstrand ec9619a83e vulkan/physical_device_features: Drop some unnecessary dependencies
None of these are actually used.  We parse the XML bare and don't need
any extension or entrypoint information.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13150>
2021-10-04 22:42:32 +00:00
Adam Jackson aa30e58600 wsi/x11: Fix a misunderstanding about how xcb_get_geometry works
The code here is well-intentioned, but the only way a GetGeometry
request can fail is if you name an invalid drawable. And if we did that,
either our internal state got corrupted, or - more likely - the user
destroyed the window. In either case there's nothing more we can do with
the surface, so report that it's been lost.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13104>
2021-10-04 15:30:06 +00:00
Tapani Pälli 2e5718c957 vulkan: provide common functions to check device features
v2: move checks to vk_device_init, ignore struct types from
    provisional extensions + lots of cleanups/fixes (Jason Ekstrand)
v3: squash in following patch from Jason:
    "vulkan: Restructure vk_physical_device_check_device_features()"
v4 (Jason): Fix a Windows build error

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12867>
2021-10-01 17:37:02 +00:00
Mike Blumenkrantz 85c38d192f wsi/x11: fix uninit value by using zalloc for swapchain
==767499== Conditional jump or move depends on uninitialised value(s)
==767499==    at 0xEB8E3ED: x11_image_finish (wsi_common_x11.c:1539)
==767499==    by 0xEB8E768: x11_swapchain_destroy (wsi_common_x11.c:1640)
==767499==    by 0xEB8A8FA: wsi_common_destroy_swapchain (wsi_common.c:505)
==767499==    by 0xDE30BA1: anv_DestroySwapchainKHR (anv_wsi.c:242)
==767499==    by 0x6817A21: copper_displaytarget_destroy (zink_copper.c:192)
==767499==    by 0x6882BE6: zink_destroy_resource_object (zink_resource.c:95)
==767499==    by 0x6882447: zink_resource_object_reference (zink_resource.h:198)
==767499==    by 0x6882D33: zink_resource_destroy (zink_resource.c:123)
==767499==    by 0x688AC97: pipe_resource_destroy (u_inlines.h:145)
==767499==    by 0x688AD2E: pipe_resource_reference (u_inlines.h:162)
==767499==    by 0x688BE1E: zink_destroy_surface (zink_surface.c:319)
==767499==    by 0x688AE0A: zink_surface_reference (zink_surface.h:102)
==767499==    by 0x688BE6D: zink_surface_destroy (zink_surface.c:328)
==767499==    by 0x67F9CA2: pipe_surface_release (u_inlines.h:134)
==767499==    by 0x67FB8AD: zink_context_destroy (zink_context.c:92)
==767499==    by 0x5D47B65: st_destroy_context_priv (st_context.c:475)
==767499==    by 0x5D49AF2: st_destroy_context (st_context.c:1193)
==767499==    by 0x5D5C90F: st_context_destroy (st_manager.c:816)
==767499==    by 0x5CC1FC9: dri_destroy_context (dri_context.c:248)
==767499==    by 0x658DD63: driDestroyContext (dri_util.c:535)
==767499==    by 0x5A30166: drisw_destroy_context (drisw_glx.c:417)
==767499==    by 0x5A32484: glXDestroyContext (glxcmds.c:515)
==767499==    by 0x5315AEB: glXDestroyContext (libglx.c:332)
==767499==    by 0x4AA8E7D: glXDestroyContext (g_libglglxwrapper.c:384)
==767499==    by 0x4D5A3F0: ??? (in /usr/lib64/libwaffle-1.so.0.6.1)
==767499==    by 0x499DDD5: piglit_wfl_framework_teardown (piglit_wfl_framework.c:638)
==767499==    by 0x499E4C5: piglit_winsys_framework_teardown (piglit_winsys_framework.c:238)
==767499==    by 0x499F50C: destroy (piglit_x11_framework.c:212)
==767499==    by 0x498C535: destroy (piglit-framework-gl.c:210)
==767499==    by 0x4F48AF6: __run_exit_handlers (in /usr/lib64/libc-2.33.so)
==767499==    by 0x4F48C9F: exit (in /usr/lib64/libc-2.33.so)
==767499==    by 0x4AEFD71: piglit_report_result (piglit-util.c:245)
==767499==    by 0x499F2CA: process_next_event (piglit_x11_framework.c:139)
==767499==    by 0x499F365: enter_event_loop (piglit_x11_framework.c:153)
==767499==    by 0x499DF88: run_test (piglit_winsys_framework.c:88)
==767499==    by 0x498C5EF: piglit_gl_test_run (piglit-framework-gl.c:229)
==767499==    by 0x4022B4: main (primitive-restart.c:45)
==767499==  Uninitialised value was created by a heap allocation
==767499==    at 0x484086F: malloc (vg_replace_malloc.c:380)
==767499==    by 0xE964E85: vk_default_alloc (vk_alloc.c:26)
==767499==    by 0xEB8B24B: vk_alloc (vk_alloc.h:43)
==767499==    by 0xEB8EAF9: x11_surface_create_swapchain (wsi_common_x11.c:1723)
==767499==    by 0xEB8A82A: wsi_common_create_swapchain (wsi_common.c:476)
==767499==    by 0xDE30B47: anv_CreateSwapchainKHR (anv_wsi.c:225)
==767499==    by 0xE96134F: vk_tramp_CreateSwapchainKHR (vk_dispatch_table.c:6592)
==767499==    by 0xD7B88F0: ??? (in /usr/lib64/libvulkan.so.1.2.162)
==767499==    by 0x6817796: copper_CreateSwapchain (zink_copper.c:123)
==767499==    by 0x6817960: copper_displaytarget_create (zink_copper.c:170)
==767499==    by 0x6884C65: resource_create (zink_resource.c:780)
==767499==    by 0x6884EC5: zink_resource_create_drawable (zink_resource.c:829)
==767499==    by 0x5CC0FE3: copper_allocate_textures (copper.c:199)
==767499==    by 0x5CC28C2: dri_st_framebuffer_validate (dri_drawable.c:82)
==767499==    by 0x5D5B69A: st_framebuffer_validate (st_manager.c:222)
==767499==    by 0x5D5D32D: st_api_make_current (st_manager.c:1102)
==767499==    by 0x5CC220B: dri_make_current (dri_context.c:306)
==767499==    by 0x658DE23: driBindContext (dri_util.c:588)
==767499==    by 0x5A3022A: drisw_bind_context (drisw_glx.c:435)
==767499==    by 0x5A36CC2: MakeContextCurrent (glxcurrent.c:220)
==767499==    by 0x5A36DF9: glXMakeCurrent (glxcurrent.c:253)
==767499==    by 0x531849C: InternalMakeCurrentVendor (libglx.c:875)
==767499==    by 0x53185C3: InternalMakeCurrentDispatch (libglx.c:930)
==767499==    by 0x5318DE5: CommonMakeCurrent (libglx.c:1074)
==767499==    by 0x5318ED5: glXMakeCurrent (libglx.c:1119)
==767499==    by 0x4AA9CFA: glXMakeCurrent (g_libglglxwrapper.c:930)
==767499==    by 0x4D5AA36: ??? (in /usr/lib64/libwaffle-1.so.0.6.1)
==767499==    by 0x4D5E16E: waffle_make_current (in /usr/lib64/libwaffle-1.so.0.6.1)
==767499==    by 0x499C8CD: wfl_checked_make_current (piglit-util-waffle.h:115)
==767499==    by 0x499DA04: make_context_current_singlepass (piglit_wfl_framework.c:488)
==767499==    by 0x499DC43: make_context_current (piglit_wfl_framework.c:565)
==767499==    by 0x499DD88: piglit_wfl_framework_init (piglit_wfl_framework.c:628)
==767499==    by 0x499E3FC: piglit_winsys_framework_init (piglit_winsys_framework.c:209)
==767499==    by 0x499F581: piglit_x11_framework_create (piglit_x11_framework.c:229)
==767499==    by 0x499E361: piglit_winsys_framework_factory (piglit_winsys_framework.c:175)
==767499==    by 0x498CA60: piglit_gl_framework_factory (piglit_gl_framework.c:53)
==767499==    by 0x498C587: piglit_gl_test_run (piglit-framework-gl.c:221)
==767499==    by 0x4022B4: main (primitive-restart.c:45)

Fixes: b5c390c113 ("vulkan/wsi: add support for detecting mit-shm pixmaps.")

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13124>
2021-09-30 19:56:51 +00:00
Jason Ekstrand 24637a6579 vulkan/shader_module: Fix the lifetime of temporary shader modules
The vk_shader_module_handle_from_nir() macro was constructing a
temporary vk_shader_module and passing it through
vk_shader_module_to_handle().  Since this is a function and not a macro,
it means that the lifetime of the temporary vk_shader_module will end
once the to_handle() function is called.  Technically, this is a
use-after-free.  I really don't know why no one has been bitten by this
yet....

Fixes: a41e98ddca "vk/util: add a util macro for initializing stack..."
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13101>
2021-09-29 23:27:52 +00:00
Joshua Ashton adbe4022c6 vulkan/util: Cast vk_alloc pointers
Fixes errors when trying to use vk_alloc.h from C++ code.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13103>
2021-09-29 17:42:17 +00:00
Jason Ekstrand 0e4266260a vulkan/device: Add a common DeviceWaitIdle implementation
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:25 +00:00
Jason Ekstrand 3b535d28d2 vulkan/device: Add a common GetDeviceQueue2 implementation
If we store the queues in a linked list in the device as vk_queue_init
is called then we can handle enumeration in common code.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:25 +00:00
Jason Ekstrand b2313b6884 vulkan: Add the pCreateInfo to vk_queue_init()
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:25 +00:00
Emma Anholt cc6954ec0b vulkan: Update the XML and headers to 1.2.193
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13007>
2021-09-24 17:55:10 +00:00
Yevhenii Kolesnikov d55d1fcda2 vulkan: Add convenience debug message helpers
Forwards the message to both VK_EXT_debug_utils and
VK_EXT_debug_report provided callbacks.

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10318>
2021-09-23 21:14:32 +00:00
Yevhenii Kolesnikov 2db5536a46 vulkan: Add vk_asprintf and vk_vasprintf helpers
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10318>
2021-09-23 21:14:32 +00:00
Yevhenii Kolesnikov 98d22acca2 vulkan/enum_to_str: Add generator for VkObjectType to Vulkan Handle
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10318>
2021-09-23 21:14:32 +00:00
Yevhenii Kolesnikov 3b361b234a vulkan: Implement VK_EXT_debug_utils
This implements all the necessary features of VK_EXT_debug_utils in
common code.

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10318>
2021-09-23 21:14:32 +00:00
Emma Anholt 8a54903a48 vulkan: Support PHYSICAL_DEVICE_1_n_ features/properties in the helpers.
Since we have a filled out struct available, just memcpy it over so the
driver doesn't have to fill it out again.

Suggested by Jason, this is code that isn't copy-and-paste from anv.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12967>
2021-09-23 16:19:47 +00:00
Emma Anholt 19ff5019b7 vulkan: Add helpers for filling exts for core features and properties.
This is boilerplate that drivers have to replicate, so make a nice helper.
The feature/property macro lists are are copy and pasted from anv, though
the helper functions has been split between 1.1 and 1.2 (and thus the macros
refactored).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12967>
2021-09-23 16:19:47 +00:00
Yevhenii Kolesnikov cff01303b5 vulkan: Add a common vk_queue structure
This can be used e.g. for storing debug labels for the common
implementation of VK_EXT_debug_utils.

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.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 ef9c371f60 vulkan: Add a common vk_command_buffer structure
This can be used e.g. for storing debug labels for the common
implementation of VK_EXT_debug_utils.

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13000>
2021-09-23 15:57:45 +00:00
Zachary Michaels fc5ea6a054 X11: Ensure that VK_SUBOPTIMAL_KHR propagates to user code
Commit 0245b825 switched from returning the error code VK_ERROR_OUT_OF_DATE_KHR
to returning the success code VK_SUBOPTIMAL_KHR. Prior to that commit, the error
code caused all code paths to fail immediately, but the success code does not.

Currently the success code is not recorded in some scenarios, resulting in a
result of VK_SUCCESS instead. This breaks applications that rely on the
result (per the spec) to trigger resizes.

This commit ensures that the proper VK_SUBOPTIMAL_KHR success code is set as a
sticky status (as comments indicate was intended), ensuring that it is
propagated to user code.

Fixes #5331

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12782>
2021-09-20 16:43:10 +00:00
Simon Ser 3c18e69078 vulkan/wsi/x11: add driconf option to not wait under Xwayland
By default, Mesa's X11 Vulkan WSI will wait for buffers to be ready
before submitting them to Xwayland when the swapchain is created
with the IMMEDIATE mode.

This is undesirable when the Wayland compositor already monitors
fences. A Wayland compositor may want to know the delay between
the buffer submition and the end of the GPU work, this is impossible
to measure if the WSI waits for the buffer to be ready before
submission.

Since most compositors don't monitor fences, let's introduce a driconf
option for this for now. We can reconsider once more compositors
have better support for fences.

Signed-off-by: Simon Ser <contact@emersion.fr>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11290>
2021-09-13 19:38:13 +00:00
Danylo Piliaiev 3dd1bb6355 turnip: implement basic perfetto support
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10969>
2021-09-10 14:58:28 +03:00
Marcin Ślusarz 8408cce303 vulkan/wsi/x11: fix shm allocation control flow issue
shmget returns -1 on error. alloc_shm assigns it to an unsigned variable
and then checks whether it's < 0, which will never be true.

Found by Coverity.
CID: 1490891

Fixes: 1f55f9a97a ("vulkan/wsi/sw: add support for using host_ptr for shm pixmaps.")

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12696>
2021-09-03 08:33:36 +00:00
Tomeu Vizoso 0005b90ba9 vulkan: Copy pNext structures when enqueuing commands
There is enough information in vk.xml to figure how to copy the chain of
extensions, so use it.

Otherwise, the caller might have released the structs after recording
the command but before it executes.

Closes #5314.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reported-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12701>
2021-09-03 07:33:21 +02:00
Tomeu Vizoso 03d586899e Revert "lavapipe: unbreak imageless framebuffer"
This reverts commit c679dbe09c.

No need to override the generated cmd enqueing function, we can use the
information in vk.xml to do the right thing with pNext arguments.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12701>
2021-09-03 07:33:21 +02:00
Samuel Pitoiset f695171e38 vulkan: add common entrypoints for sparse image requirements/properties
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12416>
2021-09-02 10:56:39 +00:00
Iago Toral Quiroga 77f2e2a75f vulkan: allow creating color views from depth/stencil images
Some drivers may want to implement certain depth/stencil operations by
reinterpreting a depth/stencil format as a color format. This is not
strictly allowed by the Vulkan spec, so handle it separately.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12668>
2021-09-02 05:53:39 +00:00
Mike Blumenkrantz c679dbe09c lavapipe: unbreak imageless framebuffer
vk cmd queue doesn't copy pNext pointers

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12688>
2021-09-01 21:40:00 -04:00
Tomeu Vizoso ec44c48945 vulkan: Remove dependency on Python 3.9+
Closes #5311.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Fixes: 997a6ca226 ("vulkan: Generate entrypoints that enqueue commands")
Fixes: a7b0946ef0 ("vulkan: Generate code to place commands in a queue")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12672>
2021-09-01 19:46:14 +00:00
Tomeu Vizoso 997a6ca226 vulkan: Generate entrypoints that enqueue commands
For drivers such as Lavapipe that record the commands at the execution
stage.

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
Tomeu Vizoso a7b0946ef0 vulkan: Generate code to place commands in a queue
It can be used by lavapipe and also by drivers for GPUs with command
streams that require values related to the framebuffer, thus the command
stream emission for secondary buffers needs to be deferred until the
framebuffer is known (execution time).

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
Tomeu Vizoso 925a8fac17 vulkan: Read len attribute of parameters to functions
It will be needed for generating code that needs to know the size of
arrays.

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
Samuel Pitoiset d465095fc0 vulkan: Update the XML and headers to 1.2.190
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12611>
2021-08-30 18:39:20 +00:00
Dave Airlie a069b4e9b9 vulkan/wsi/sw: add mit-shm support for pixmap allocation
This allocate the mit-shm pixmap instead of dri3 pixmaps and
uses the present paths when mit-shm is enabled

Acked-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12482>
2021-08-29 20:26:13 +00:00
Dave Airlie 1f55f9a97a vulkan/wsi/sw: add support for using host_ptr for shm pixmaps.
This pipes the allocation of the MIT-SHM pixmap into the wsi common
code to callback to the x11 path to allocate things in the right place.

Acked-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12482>
2021-08-29 20:26:13 +00:00
Dave Airlie b5c390c113 vulkan/wsi: add support for detecting mit-shm pixmaps.
This just adds the xcb bits to detect is the host supports shared
shm pixmaps or whether the old paths should be used.

shm pixmaps will only be used if dri3 is available

Acked-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12482>
2021-08-29 20:26:13 +00:00
Dave Airlie 0cddfba328 vulkan/wsi/sw: wait for image fence before submitting to queue
With hw devices, when you submit a present, implicit sync will
make sure the work submitted to the gpu on the client will end
up happening before the present work submitted on the server.

However with sw paths there is no real GPU, the lavapipe fake
GPU thread is client side only and presenting is done directly
from the pixmap (or later shared pixmap). In order for this to
make sense the wsi common code should wait for the fence on the
image before queueing the submit to the server so that all
client works has been flushed to the pixmap before the copy or
present operation is submitted.

Fixes: 8004fa9c95 ("vulkan/wsi: add sw support. (v2)")
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12502>
2021-08-24 03:30:17 +10:00
Leandro Ribeiro 8107f67171 vulkan/wsi/wayland: memset members of image to zero
struct wsi_wl_image is only used as member of the swapchain, and during
the swapchain creation the image is already initialized to zero. So we
have no problems with members of the image being used uninitialized.

But for consistency, memset the members of this struct to zero in
wsi_wl_image_init(). This can help to avoid problems in the future.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12451>
2021-08-20 18:51:36 +00:00
Leandro Ribeiro 4cd187e71e vulkan/wsi/wayland: create swapchain using vk_zalloc()
In wsi_wl_surface_create_swapchain() we have a piece of code to init
some members of the chain to 0, in order to allow us to call
wsi_wl_swapchain_destroy() for cleanup.

Instead, we can use vk_zalloc() to allocate the chain, as it initializes
all members of the struct to zero. This help us to avoid problems when
people add new members to the struct and forget to initialize them.
Also, it makes the code look better.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12451>
2021-08-20 18:51:36 +00:00
Jason Ekstrand 3ed4ddf076 anv,vulkan: Add a vk_image::wsi_legacy_scanout bit
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/12023>
2021-08-17 21:29:35 +00:00
Jason Ekstrand def2cb9808 anv,vulkan: Move drm_format_mod to vk_image
Even though we can't really do the parsing on behalf of the driver (it's
too complicated), storing it in the vk_image lets us provide a common
implementation of vkGetImageDrmFormatModifierPropertiesEXT().  It'll
also be useful in the next few commits for swapchain images.

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/12023>
2021-08-17 21:29:35 +00:00
Jason Ekstrand 0f2afa0abc anv,vulkan: Move ANV image layout helpers to common code
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/12023>
2021-08-17 21:29:35 +00:00
Jason Ekstrand 9cc004b3d0 vulkan: Add a vk_image_view struct
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12023>
2021-08-17 21:29:35 +00:00
Jason Ekstrand 48e8efd00e vulkan,radv: Move vk_format_depth/stencil_only to common code
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12023>
2021-08-17 21:29:35 +00:00
Jason Ekstrand c36ff60a52 vulkan: Refactor and better document vk_image_expand_aspect_mask
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/12023>
2021-08-17 21:29:35 +00:00
Jason Ekstrand 83b4d4f17d anv,vulkan: Move VkImageSubresource* helpers from ANV
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/12023>
2021-08-17 21:29:35 +00:00
Jason Ekstrand e45e4e3ba1 anv,vulkan: Move anv_image_expand_aspects to common code
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/12023>
2021-08-17 21:29:35 +00:00
Jason Ekstrand 0e6c320a7d vulkan: Add a vk_image struct
Currently, this is optional for drivers to carry around but it scrapes
up most of VkImageCreateInfo for you and parses a couple of extension
structs.  We also add a few useful little helpers copied over from ANV.

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/12023>
2021-08-17 21:29:34 +00:00
Leandro Ribeiro d18f102275 vulkan/wsi/wayland: add helper function find_format()
There are some places in the code in which we search for a certain
format in the u_vector. This new function help us to avoid repetition.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
2021-08-16 10:23:06 +02:00
Leandro Ribeiro cb3b4609c1 vulkan/wsi/wayland: always initialize format vector
In wsi_wl_display_init(), the format vector is initialized only when the
caller sets the function to query the formats/modifiers. But
wsi_wl_display_finish() always release the vector, no matter if it has
been initialized or not.

For now it just works because the u_vector_foreach() macro works when
the format vector is uninitialized, but it is a weird design to try to
release something that has not been initialized.

So in this patch we start to always initialize the format vector, even
when not querying formats/modifiers.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
2021-08-16 10:22:50 +02:00
Simon Ser 151b65b211 vulkan/wsi/wayland: generalize modifier handling
Instead of having hard-coded lists of modifiers for argb8888 and
xrgb8888, store a list of modifiers alongside each VkFormat. To
achieve this goal, introduce a new struct wsi_wl_format that holds
both a VkFormat and a modifier list, and use it for the items in
the formats list.

This commit unlocks non-{A,X}RGB8888 formats, which were previously
always disabled for linux-dmabuf.

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
2021-08-16 10:22:48 +02:00
Leandro Ribeiro 7383827acc vulkan/wsi/wayland: fold wsi_wl_display_swrast and wsi_wl_display_dmabuf into parent
The two structs wsi_wl_display_swrast and wsi_wl_display_dmabuf have in
common the list of formats and the only difference between both is the
interface object.

As we know that only one of the arrays is populated (we never bind to
wl_shm and the dmabuf interface simultaneously), we can move the members
of these structs to wsi_wl_display and simplify the code.

This is based on previous work of Simon Ser <contact@emersion.fr>.

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
2021-08-16 10:22:39 +02:00
Leandro Ribeiro 1c9299eade vulkan/wsi/wayland: fix crash when force_bgra8_unorm_first is true
When force_bgra8_unorm_first is true, we access display->formats and
change the order of certain formats. The final result is BGRA8_UNORM
being the first in the format list, as some clients require this.

But we are trying to do this before before setting up display->formats,
so it should result in a crash. Fix this by changing the order of
things. Now we first set up display->formats before trying to access it.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
2021-08-16 10:22:35 +02:00
Leandro Ribeiro db2635020f vulkan/wsi/wayland: do not perform roundtrip when not querying formats
When we call wsi_wl_display_init() with get_format_list set to false
there's no need to dispatch the events from the interfaces. This allow
us to remove a check in the event handlers to verify if we're querying
the formats or not, what makes the code easier to read.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
2021-08-16 10:22:28 +02:00
Leandro Ribeiro 4bf011a768 vulkan/wsi/wayland: check directly if we got globals successfully
Until now we had a weird way to bail out if we could not get any
globals. Instead, add a direct check, what makes the code easier to
read.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
2021-08-16 10:22:20 +02:00
Simon Ser e090316570 vulkan/wsi/wayland: drop support for wl_drm
Nowadays, all Wayland compositors implement linux-dmabuf. We
shouldn't need to support the legacy wl_drm interface anymore.

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
2021-08-16 10:22:17 +02:00
Simon Ser 9990a351e8 vulkan/wsi/wayland: use drm_fourcc.h for formats
drm_fourcc.h is the canonical source for DRM formats. Instead of
using the values from wl_drm, use the canonical header.

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
2021-08-16 10:21:38 +02:00
Eric Engestrom 4d9acfa533 python: drop explicit output_encoding='utf-8' in mako templates
Python 3 handles unicode strings by default, so we can drop all that.

Suggested-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3674>
2021-08-14 21:44:32 +00:00
Eric Engestrom f1eae2f8bb python: drop python2 support
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3674>
2021-08-14 21:44:32 +00:00
Pavel Asyutchenko 4374e7fb45 vulkan/overlay: Fix violation of VUID-VkMappedMemoryRange-size-01389
Mapping lentgh must be a multiple of 'nonCoherentAtomSize' bytes
when using VK_WHOLE_SIZE in vkFlushMappedMemoryRanges.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12131>
2021-07-30 11:38:40 +00:00
Alejandro Piñeiro 476dc3c050 vulkan: add vk_spec_info_to_nir_spirv util method
All vulkan drivers have been copying anv's code to convert
VkSpecializationInfo into nir_spirv_specialization.

Recently there was a Vulkan spec change on allowed values for
VkSpecializationInfo, and all drivers got affected.

This commits creates a new helper, and uses it on all Vulkan Mesa
drivers.

v2: use (uint8_t*) castings, instead of void*, to avoid C2036 with
    MSVC (detected by the CI, inspired on what radv was doing)

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12047>
2021-07-29 03:28:52 +00:00
Chia-I Wu 206fe780d5 vulkan/wsi/x11: do not inherit last_present_mode
Under XWayland, the first present after a window resize is sometimes
completed with COPY (seems to happen when the previous present with the
old size is pending; not really sure).  The following presents are
completed with FLIP.

When a swapchain is created with an old swapchain, and
old_chain->last_present_mode is FLIP, chain->last_present_mode is set to
FLIP as well.  This causes the new swapchain to be marked
VK_SUBOPTIMAL_KHR, which is sticky, if the first present is completed
with COPY.

Instead of inheriting, treat each swapchain as independent.  We will
miss the case where an old swapchain is flipping but a new swapchain is
copying.  But swapchain reallocation normally happens in response to
present engine state change.  If the newly allocated swapchain is
copying, another reallocation is unlikely to fix that.

Fixes: 61309c2a72 ("vulkan/wsi/x11: Return VK_SUBOPTIMAL_KHR for X11")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12030>
2021-07-28 01:05:50 +00:00
Shmerl 8aa6002943 vulkan/overlay: don't display histogram and range for device and format
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4320
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12056>
2021-07-25 21:29:31 +00:00
Chia-I Wu bd9550b026 vulkan/wsi: replace prime_blit_buffer by a bool
venus only needs to know if a WSI image is a prime blit source.  In an
upcoming swapchain image rework, the prime blit destination is unknown
when the WSI image is created.  Replace prime_blit_buffer by a bool.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12046>
2021-07-23 15:31:20 -07:00
Caio Marcelo de Oliveira Filho a3e53495a9 vulkan: Update XML and headers to 1.2.185
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11981>
2021-07-21 20:15:21 +00:00
Dave Airlie 75aa8524ec wl/shm: don't fetch formats if not requested.
This aligns the code with the drm format code

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11945>
2021-07-20 05:03:04 +10:00
Caio Marcelo de Oliveira Filho 34aae6a1f2 vulkan/util: Add and use vk_multialloc_zalloc variants
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11890>
2021-07-15 21:34:53 +00:00
Daniel Stone 49a7c92793 vulkan/wsi/wayland: Initialise wl_shm pointer in VkImage
We don't explicitly calloc the wsi_wl_image to zero; anything that's
expected to be valid needs to be explicitly initialised.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5063
Fixes: 6b36f35734 ("vulkan/wsi/wl: add wl_shm support for lavapipe.")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Jan Beich <jbeich@freebsd.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11909>
2021-07-15 21:57:30 +01:00
Daniel Stone 1061ebb6da vulkan/wsi/wayland: Cosmetic alignment fix
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11909>
2021-07-15 21:57:29 +01:00
Erik Faye-Lund e3542b35a8 vulkan: allocate host-visible memory for swapchain images
The Vulkan 1.2 specification, section 11.2.12 ("Host Access to Device
Memory Objects") say the following:

> memory must have been created with a memory type that reports
> VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT

Since there's no guarantee that there's any memory that is *both*
device-local *and* host-visible, let's just use the latter requirement.

Fixes: 8af568e4ae ("vulkan: implement wsi_win32 backend")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11848>
2021-07-14 07:09:38 +00:00
Erik Faye-Lund d0c7a2106b vulkan: do not map zero-sized region of memory
The Vulkan 1.2 specification, section 11.2.12 ("Host Access to Device
Memory Objects") say the following:

> If size is not equal to VK_WHOLE_SIZE, size must be greater than 0

So, mapping a zero-sized range is illegal. Let's instead map the
reported size of the image, which we already know.

Fixes: 8af568e4ae ("vulkan: implement wsi_win32 backend")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11848>
2021-07-14 07:09:38 +00:00
Dave Airlie 6b36f35734 vulkan/wsi/wl: add wl_shm support for lavapipe.
This adds swrast support for rendering from lavapipe.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11819>
2021-07-12 20:27:48 +00:00
Georg Lehmann d8c1bf4a7d vulkan/wsi/wayland: Add support for more SRGB formats.
This is required by the Vulkan specification:

If pSurfaceFormats includes an entry whose value for colorSpace is
VK_COLOR_SPACE_SRGB_NONLINEAR_KHR and whose value for format is a UNORM
(or SRGB) format and the corresponding SRGB (or UNORM) format is a color
renderable format for VK_IMAGE_TILING_OPTIMAL, then pSurfaceFormats must also
contain an entry with the same value for colorSpace and format equal to the
corresponding SRGB (or UNORM) format.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11778>
2021-07-09 11:54:43 +00:00
Jason Ekstrand d4b482d378 android: Drop the Android.mk build system
Android.mk files haven't really been supported by Mesa devs for a long
time.  Most of us have been willing to update Makefile.sources if we
remember and sometimes we try to blind code some Android.mk for a new
generator.  However, the reality is that it breaks regularly and ends up
being maintained by the Android community.  To address this problem
another approach was implemented in !10183 utilizing the maintained
meson build system.  The old Android.mk files are no longer required.

This commit was created with the following commands:

    git rm **/Android.mk
    git rm **/Android.*.mk
    git rm **/Makefile.sources
    git rm CleanSpec.mk

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4487
Acked-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9728>
2021-07-08 14:44:02 -05:00
Chia-I Wu a8173a78a3 vulkan/wsi: fix select_memory_type when all MTs are local
The intention is to pick the system memory for the prime blit dst, but
that is not possible when all memory types are advertised to be local.

This fixes venus over vtest (i.e., unix socket) because the driver
provides no PCI bus info and wsi_device_matches_drm_fd returns false.  A
driver might also use can_present_on_device to force prime blit.

Fixes: 469875596a ("vulkan/wsi: Fix prime blits to use system memory for the destination")

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11774>
2021-07-08 17:08:46 +00:00
Simon Ser 3ee30d98ff vulkan/wsi/wayland: handle dmabuf params allocation failure
Return VK_ERROR_OUT_OF_HOST_MEMORY if
zwp_linux_dmabuf_v1_create_params fails.

Signed-off-by: Simon Ser <contact@emersion.fr>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11589>
2021-07-08 12:05:28 +02:00