Commit Graph

195334 Commits

Author SHA1 Message Date
Gurchetan Singh
dd639c700e gfxstream: guest: fix useless return statement
Oops.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
aed7f4c79c gfxstream: linux guest: support client-side blob allocations
This makes Linux guests create color buffers blobs and
buffer blobs, in response to dedicated image and buffer
requests from the guest.  This is only done in Linux guests
for now.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
303191b81e gfxstream: host + guest: bump up version of the protocol
This reports the new host side capabilities (the ability to
make exportable color buffer blobs) back to the guest.
This feature is only used with experimental Linux guest
support in gfxstream.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
a5788932c9 gfxstream: guest: enable virtio-gpu kumquat
This uses libvirtgpu_kumquat_ffi.so to send commands to the
Kumquat Media Server.  The implementation of Kumquat is found
at crrev.com/c/5645904.

This is a more complex, but more fully featured end-to-end testing
framework.  This biggest benefit it is can run complex apps (vkcube,
gfxbench + ANGLE/Zink) on Linux, without a VM or a full Android tree.
The rutabaga FFI path -- which relied on a nested Vulkan loader -- didn't
work for complex apps and funkiness was observed with the nested
Vulkan loader.

Plus, app 1 + app 2 could connect Kumquat at the same time.

This may also benefit snapshot tests, particular since end to end
flow relies on external blob.  For example, a snapshot save command
could actually call stream_renderer_teardown(..) on the host-side,
while the guest retains it's state (ASG mappings + vulkano mappings).

A snapshot restore would actually call stream_renderer_init(..)
+ stream_renderer_restore(..), which an actual upstream VMM would
do.

Another additional benefit is multi-context testing.  Since
libvirtgpu_kumquat_ffi.so is portable, other libraries (minigbm)
can also call it.  We can mimic the cross-domain context allocating
via libminigbm.so, while context libgfxstream_vulkan.so imports the
file descriptor.

This change only transitions the meson build since the main goal
is once again is Linux on Linux testing w/o an Android tree.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Yahan Zhou
d02b246fbc Revert^2 "Add snapshot support for vkBindImageMemory2"
This reverts commit e43734cb0fa4e938f6ca43a01ed82d5921ad3f0d.

Reason for revert: have a real fix in aosp/3151746

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Yahan Zhou
1c3c0886f1 Fix Vulkan snapshot with -guest-angle
We did a few things here.

1. Update VkBindImageMemoryInfo in vkBindImageMemory2 for snapshot. In
   its implementation, vkBindImageMemory2 sometimes replaces an unboxed
   VkImage handle with a new one, which breaks snapshot. We update its
   value so that it can map to the proper one when calling snapshot
   functions. Note that there is a const cast which we might want to fix
   later.
2. Lock it properly when calling createExtraHandlesForNextApi.
3. Add support for more VkImage format. Fix mipmap extend calculation.

Now it works with -guest-angle but fails with VVL, not sure why.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
9ec275e10b Revert "Add snapshot support for vkBindImageMemory2"
This reverts commit 58934c4400e20934ef3172aab1a5ebefaa08e786.

Reason for revert: Breaks meson build
Same issue has aosp/3141746

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
05371b2451 gfxstream: don't define hasDedicatedImage + hasDedicatedBuffer multiple times
Every guest OS uses it (Linux, Android, Fuchsia).  Probably we
should clean up/merge logic further.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Yahan Zhou
7b9c9a1b3c Add snapshot support for vkBindImageMemory2
The pattern of vkBindImageMemory2 doesn't really fit with what we have
in the auto-code generator. Thus we need to implement a special entry
for it in the code generator. In future we might want to split the code
and directly write c++ code for similar APIs.

Note that due to complexity we only support vkBindImageMemory2 with
bindInfoCount == 1, for now.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Serdar Kocdemir
96b42bdbee Remove direct usages of MoltenVK library functions
These APIs and the related extension are deprecated in favor of the new
metal_objects extension to make sure the loader can intercept them, so that the layers, such as VVL, would work fine.
Removes necessity to load functions directly from a separate dylib.
VK_MVK_moltenvk extension support is still passed to the guest side
due to the existing checks for enabling the AHB extension.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
a7fdf81103 gfxstream: guest: support blobCmd + blobCmdSize
This is useful for trying to hook into gfxstream's
ColorBuffer handlers, without creating shadow guest
memory associated with RESOURCE_CREATE_3D.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
7dca2000ad gfxstream: guest: add XCB Surface support
This is needed to run X11 apps via libvulkan_gfxstream.so

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
7406c49842 gfxstream: guest: add VK_EXT_color_write_enable
Zink uses this extension.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Jean-François Thibert
e62a33012b Add depth formats support to import/export
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
e7b736e8c6 gfxstream: ResourceTracker: fix mesa_loge(..)
Fixes Linux build.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
ead73173bf Revert "Revert "gfxstream: Add vkCmdPipelineBarrier2 implementat..."
Revert submission 3125001

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Serdar Kocdemir
5cb7bbce17 Add VK_EXT_debug_report extension support
This extension is enabled from the platform side via the Android
loader and the applications using the functions or structures of
it would crash even if they check the support of the extension.
Guest callback addresses within the structures of this extension
cannot be used and are already being removed when creating the
instances.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
a355544680 Revert "gfxstream: Add vkCmdPipelineBarrier2 implementation in VkDecoderGlobalState"
This reverts commit c4de357e4f0b256a246007982aacde2dedc10d15.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
afd2d7fd8d Revert^2 "gfxstream: add VK_EXT_vertex_attribute_divisor"
This reverts commit 626ca943a0426d7cd002aae18b31652e35153540.

Reason for revert:

- gfxstream isn't used this particular failing test infra
- unclear how graphics would affect networking

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
PODISHETTY KUMAR
8cd2380d89 Revert "gfxstream: add VK_EXT_vertex_attribute_divisor"
This reverts commit fccacb01ecc3e91236f006107b9e14b86cc490a9.

Reason for revert: <Likely culprit for b/346877632  - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.>

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
e6cf3feeb5 gfxstream: add VK_EXT_vertex_attribute_divisor
Already supported via codegen.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Yahan Zhou
3c609a9bf9 Fix handle create mismatch for Vulkan snapshot
In our implementation, VkQueue is created in vkCreateDevice instead of
vkGetDeviceQueue. We will need to track their creation API properly,
otherwise there will be a name mismatch on snapshot load. This will
result in a crash during snapshot load with -guest-angle.

This commit marks their creation API properly.

Same thing applies for VkDescriptorSet.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Aaron Ruby
561b6773c2 gfxstream: Add vkCmdPipelineBarrier2 implementation in VkDecoderGlobalState
Useful for specializing this function.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
61706c9a67 gfxstream: valgrind fix
Some people have Valgrind on their system and may
need this.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Aaron Ruby
e6fa8819b0 gfxstream: Add linearPeerImage for Linux guests, to use for imageLayout queries
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Aaron Ruby
cf8e324fe5 gfxstream: Switch to using scanout path with native DRM images for Linux WSI
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Aaron Ruby
6b92e632da gfxstream: Change createResource to use stride instead of bpp
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Aaron Ruby
24cb362a9c gfxstream: Remove VkImage from functable handle translation
Not required for any Mesa object backings.
TODO: Investigate why VkBuffer still required (and crashing without
translation)

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Gurchetan Singh
f667ed01e7 gfxstream: convert some Vulkan to mesa_log(..)
There are still some places left in the libgfxstream_vulkan.so
dependencies. For example, guest/platform &
guest/OpenglSystemCommon.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Aaron Germuth
bad010e728 Add VK_EXT_host_query_reset to guest's allowed device extensions
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a6fa05a299d1cb7e299a00c7554331027ee0a874)

Merged-In: I47778e5b78852f896b41dcf900ae1cf595bb9a27
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Sergiu
694638d30c Tweaking YCBCR conversion to return correct VK Format
* Adding a drm format field in cb_handler
* Convert android->vulkan format mapping into drm->vulkan format mapping

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Yahan Zhou
85d52f5780 Add snapshot for command buffer
Record all vkCmd* commands. Also clear them on vkResetCommandBuffer.

Also use VK_IMAGE_ASPECT_STENCIL_BIT when snapshotting stencil
images.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Jason Macnak
26a0c8dd09 Support BGRA render target in CompositorVk
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Jason Macnak
5b9905b329 Remove extra semicolon in VkEncoder
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:01 +00:00
Serdar Kocdemir
d63edd44c3 Mark VK_MVK_moltenvk extension as supported on vulkan
MoltenVK extension code was not being generated because of the
missing "supported=vulkan" tag required by the code generator.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Jean-Francois Thibert
0fe71cc5da gfxstream: move staging reset to end of reset command buffer
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Serdar Kocdemir
e4f720c955 Add VK_EXT_metal_objects support
Adding VK_EXT_metal_objects to the supported extensions
for the host side operations.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Jean-Francois Thibert
2aad7d2b00 gfxstream: Fix usage of encoder after release in vkResetCommandBuffer
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Aaron Ruby
fcb2b62bfe gfxstream: Revert all unnecessary gfxstream_vk_* object types and corresponding translations in functable.
Original approach was to translate all possible handle types for complete
Mesa object equivalence. Practically, only a subset of these objects
actually need to be real Mesa objects for use with WSI. This simplifies
the translation and handwritten entries substantially, which is somewhat
brittle and bug-prone.

Clean up parts of functable.py that we don't need.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Aaron Ruby
a1920507dc gfxstream: Clean up VK_KHR_external_memory_fd support for Linux
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Aaron Ruby
07c232e3b3 gfxstream: Add "transformList" method for VkFences, in addition to VkSemaphores
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Aaron Ruby
9908be77c7 Revert "Reland "Partial revert of aosp/2858589 to avoid Mesa layer for Android""
In preparation for making the issue less likely to appear.

This reverts commit 696eaaa012e369157dd745d1bf083b4dc064deaf.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Gurchetan Singh
47b0536ba2 gfxstream: always advertise device memory extension guest side
memory report extension is present.  It's is filtered out when
sent host side, since for a virtual GPU this is quite difficult
to implement.

Mesa runtime is picky about physical device features.  So if
the test tries to enable device level extension without it
definitely existing, the test will fail.

The test can also be modified to check
VkPhysicalDeviceDeviceMemoryReportFeaturesEXT, but that's more
involved.  Work around this by always advertising the extension.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Aaron Ruby
4a95b71975 gfxstream: Use vk_find_struct for other struct searches in gfxstream_vk_CreateDevice
It turns out we can use vk_find_struct after all.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Aaron Ruby
9149038237 gfxstream: translate physicalDevices list in VkPhysicalDeviceGroupProperties to their gfxstream objects
In preparation to fix some end2end tests.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Yahan Zhou
b38b4a7169 Snapshot VkBuffer
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Aaron Ruby
7b215df12b gfxstream: Fix createResource call for Linux-guest VirtGpu layer
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Jason Macnak
6d2dd9c22f Update vkMapMemory to not hold lock when calling into enc
... as this can lead to a deadlock with the following sequence:

Time1: guest-thread-1: vkDestroyBuffer() called
Time2:                 VkEncoder grabs seqno 1

Time3: guest-thread-2: vkMapMemory() called
Time4:                 ResourceTracker::on_vkMapMemory() locks mLock
                       for using `info_VkDeviceMemory`
Time5:                 ResourceTracker::on_vkMapMemory() calls
                       enc->vkGetBlobGOOGLE()
Time6:                 VkEncoder grabs seqno 2
Time7:                 VkEncoder sends the vkGetBlobGOOGLE with seqno
                       2 via ASG to host
Time8:                 VkEncoder waits for the `VkResult` from the
                       host via `stream->read()`

Time9: guest-thread-1: VkEncoder calls sResourceTracker->destroyMapping()
                       ->mapHandles_VkBuffer((VkBuffer*)&buffer);
                       which calls ResourceTracker::unregister_VkBuffer()

                       ResourceTracker::unregister_VkBuffer() tries to
                       locks mLock to erase the buffer's info struct
                       from `info_VkBuffer`

!!! DEADLOCKED HERE !!!

guest-thread-1 is stuck waiting on mLock (currently locked by
guest-thread-2) before it would `stream->flush();` to finishing
sending the vkDestroyBuffer() command to the host and potentially
ping its corresponding host-render-thread-1.

guest-thread-2 stuck waiting on the result from host-render-thread-2
but host-render-thread-2 won't progress until host-render-thread-1
finishes seqno 1 which needs guest-thread-1 to finish sending/pinging.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
Hailin Zhang
8d4630549d Vulkan: fix dstArrayElement index wrap issue
See https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkWriteDescriptorSet.html

> If the dstBinding has fewer than descriptorCount array elements
> remaining starting from dstArrayElement, then the remainder will
> be used to update the subsequent binding - dstBinding+1 starting
> at array element zero. If a binding has a descriptorCount of zero,
> it is skipped. This behavior applies recursively, with the update
> affecting consecutive bindings as needed to update all
> descriptorCount descriptors.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00
C Stout
8e708a6c45 [guest] Fuchsia: initialize queries
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
2024-09-19 20:06:00 +00:00