Commit graph

201327 commits

Author SHA1 Message Date
Gurchetan Singh
7b50e62179 gfxstream: mega-change to support guest Linux WSI with gfxstream
This is a mega-change to support Linux guest WSI with gfxstream.
We tried to do a branch where every commit was buildable and
runnable, but that quickly proved unworkable. So we squashed
the branch into a mega-change.

Zink provides the GL implementation for Linux guests, so we just
needed to implement the proper Vulkan Wayland/X11 WSI
entrypoints.

The overall strategy to support this is to use Mesa's WSI
functions.  The Vulkan WSI layer was also considered:

https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer

But it was less maintained compared to Mesa.  The way Mesa common
layers communicate with drivers is the through base objects
embedded in driver and a common dispatch layer:

https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/docs/vulkan/dispatch.rst
https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/docs/vulkan/base-objs.rst

Our objects are defined in gfxstream_vk_private.h.  Currently,
Mesa-derived Vulkan objects just serve as shim to gfxstream
Vulkan’s internal handle mapping. Long-term, we can use
Mesa-derived objects inside gfxstream guest Vulkan exclusively.

The flow is typically inside a Vulkan entrypoint is:

- VK_FROM_HANDLE(vk-object) to convert to a gfxstream_vk_obj
  object
- Call ResourceTracker::func(gfxstream_vk_obj->internal) or
  VkEncoder::func(gfxstream_vk_obj>internal)
- Return result

A good follow-up cleanup would be to delete older gfxstream
objects.  For example, we now have struct gfxstream_vk_device
and info_VkDevice in ResourceTracker.

Most of this logic was auto-generated and included in
func_table.cpp. Some vulkan functions were too difficult to
auto-generate or required special logic, and these are included
in gfxstream_vk_device.cpp.  For example, anything that needs to
setup the HostConnection requires special handling.

Android Blueprint support is added to the parts of Mesa needed
to build the Vulkan runtime.  One thing to call out it's
required to build the guest/vulkan_enc and guest/vulkan files
in the same shared library now, when previously have
libvulkan_enc.so and libvulkan_ranchu.so was sufficient
[otherwise, some weak pointer logic wouldn't work].

A side effect of this is libOpenglSystem must also be a static
lib, and so should libandroid_aemu too.  That conceptually makes
sense and the Meson build had been doing this all a long.  We
can probably transition everything besides libGLESv1_emulation.so,
libGLESv2_emulation.so and libvulkan_ranchu.so to be static.

This requires changes in the end2end tests, because since each
HostConnection is separate and internal to it's constituent
library. Lifetimes need to be managed separately: for example
the HostConnection instance created by the end2end tests would
not be visible inside libvulkan_ranchu.so anymore. Probably the
best solution would be improve the testing facade so a
HostConnection represents one virtio-gpu context, while some
other entity represents a virtio-gpu device (client-server
would work).

vk.xml was modified, but change sent to Khronos:

https://gitlab.khronos.org/vulkan/vulkan/-/merge_requests/6325

Fuchsia builds still need to be migrated, but they already have
Fuchsia Mesa with all the build rules so that shouldn't be too
bad. Just need to copy them over the gfxstream/Mesa hybrid.

The new command for building Linux guests is:

meson amd64-build/ -Dvulkan-drivers="gfxstream" -Dgallium-drivers="" -Dvk-no-nir=true -Dopengl=false

Big shout-out to Aaron Ruby, who did most of the gnarly codegen
needed to get the function table logic to work.

     * Run Weston/vkcube on Linux and automotive platform
     * launch_cvd --gpu_mode=gfxstream vkcube
     * launch_cvd --gpu_mod=gfxstream_guest_angle
     * vkcube + 3D Mark Slingshot extreme work with guest ANGLE and
       GL-VK interop
     * GfxstreamEnd2EndTests
     * Some select dEQP tests

Aaron Ruby (46):
  gfxstream: function table: remove entry points that are hand-written.
  gfxstream: function table: more changes
  gfxstream: function table: scope internal_arrays to encoder
  gfxstream: function table: autogenerate compoundType params
  gfxstream: add handwritten EnumeratePhysicalDeviceGroup entrypoint.
  gfxstream: function table: handle nested handle arrays
  gfxstream: function table: adding some handwritten implementations
  gfxstream: revert some unnecessary changes
  gfxstream: use vk_object_zalloc/free instead of vk_zalloc/free.
  gfxstream: revert most gfxstream objects to use vk_object_base
  gfxstream: function table: handwritten commmand-buffers/pools
  gfxstream: codegen functionality to handle special param
  gfxstream: function table: random fixes
  gfxstream: add vk_command_buffer_ops handlers
  gfxstream: func_table.py: Codegen support for nested compound type
  gfxstream: remove handwritten/add autogen entry points
  gfxstream: add gfxstream_vk_device.cpp
  gfxstream: query device and instance extensions early
  gfxstream: func_table: explicit allocation for nested arrays/compound
    types
  gfxstream: goldfish_vulkan: fix commandBuffer allocation.
  gfxstream: meson: Raise api_version in ICD config to 1.1.
  gfxstream: function table: add more handwritten entries
  gfxstream: goldfish_vulkan: update VkDescriptorSetAllocateInfo logic
  gfxstream: function table: NULL check on internal_object dereference
  gfxstream: function table: Remove POSTPROCESSES handling from
    functable
  gfxstream: mesa: Add 'gfxstream' as a -Dvulkan-drivers
  gfxstream: ResourceTracker: add some allowedExtensions
  gfxstream: gfxstream_vk_device: add wsi_common_entrypoints
  gfxstream: Move instance handling into gfxstream_vk_device.cpp
  gfxstream: ResourceTracker: Enable Linux WSI-related extensions
  gfxstream: wsi: add wsi_device initialization
  gfxstream: gfxstream_vk_device: use Mesa common physical device
    management
  gfxstream: ResourceTracker: translate mesa objects in user buffer
  gfxstream: exclude VkSampler and VkDescriptorSet objects from
    translation
  gfxstream: Add guest-side external memory support with colorBuffers.
  gfxstream: function table: Modify semaphoreList inputs to no-op
    semaphores
  gfxstream: function table: Allow VK_NULL_HANDLE for free/destroy APIs.
  gfxstream: cereal: Add VK_EXT_depth_clip_enable as supported feature.
  gfxstream: vulkan_enc: un-namespace vk_util.h and vk_struct_id.h
  gfxstream: gfxstream_vk_device.cpp: Support VK_KHR_surface and
    VK_*_surface
  gfxstream: vulkan_enc: Add support for Mesa-only extensions.
  gfxstream: ResourceTracker: Use DEVICE_TYPE_VIRTUAL_GPU always
  gfxstream: platform: add dma-buf export support with dedicatedBuffer.
  gfxstream: ResourceTracker: add VK_EXT_depth_clip_enable allowed
    extension
  gfxstream: ResourceTracker: external memory via QNX_screen_buffer
    extension
  gfxstream: Add VK_QNX_external_memory_screen_buffer to VulkanDispatch

Gurchetan Singh (18):
  gfxstream: mesa: write Android.bp files
  gfxstream: generate gfxstream_vk_entrypoints.{c, h}
  gfxstream: vulkan_enc: add gfxstream_vk_private.h (objects)
  gfxstream: function table: modify function table to use gfxstream_vk_*
  gfxstream: compiles
  gfxstream: build system improvements
  gfxstream: ResourceTracker: don't crash without
    VkBindImageMemorySwapchainInfoKHR
  gfxstream: vk.xml: make some vkAcquireImageANDROID params optional
  gfxstream_vk_device: filter out swapchain maintenance guest side
  gfxstream: end2end: fixes for End2End tests
  gfxstream: func_table: custom vkEnumerateInstanceLayerProperties
  gfxstream: add VK_EXT_DEBUG_UTILS_EXTENSION_NAME into Mesa list
  gfxstream: clang-format guest code
  gfxstream: libandroid AEMU static
  gfxstream: vkEnumerateInstanceVersion
  gfxstream: vkCreateComputePipeLines
  gfxstream: make end2end tests happy
  gfxstream: delete prior vk.xml, vk_icd_gen.py

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:05:59 +00:00
Gurchetan Singh
2354b8ce20 gfxstream: mesa: import Mesa
Mesa has Linux WSI implementations that can be used for
gfxstream.  We have to first import the parts of Mesa that
we find useful.

Just modified

- guest/src/mesa/meson.build

to remove extra project args.

- guest/src/mesa/src/meson.build

to not automatically call subdir in all directories.

This also requires the VK_NO_NIR and Android build patches, which
are fairly upstreamable.  The strategy would be to merge all changes
required in the source code.

Generally, if you want to modify the Mesa subdir, you generally
will want to have a plan for upstreaming the change.
For example, here's the Mesa VK_NIR patches.

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26574

[not upstreamed yet; but do have a plan ;-)]

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:05:59 +00:00
Lars Harrison
3104712e99 Provide error message on unhandled VK structs
This change provides more explicit error messages and a proper abort in
situations where an unhandled VK structure is attempting to be used,
based purely on calls to the size functions. This should enable better
capture and debugging of these failures in the future (rather than
hitting a segfault and having to diagnose).

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:05:59 +00:00
Igor Chernyshev
a45560cd5a Add VK_EXT_debug_utils and VK_EXT_scalar_block_layout
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:05:59 +00:00
Yahan Zhou
8dfaa0d08c Add VK_EXT_vertex_attribute_divisor support for guest ANGLE
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:05:59 +00:00
Jason Macnak
b62b11d3e2 Sort and dedup physical device extensions
... to avoid issues when running dEQP. The Vulkan Loader's trampoline
functions will remove duplicates as well but this can lead to lead
errors if Gfxstream's function returns VK_SUCCESS with N elements
(including a duplicate) but the Vulkan Loader's trampoline function
returns N-1 when querying the extension count. Then, Gfxstream will
return VK_INCOMPLETE the second time the application queries for
the actual structs with an array sized N-1.

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:05:59 +00:00
Jason Macnak
a04902c837 Wrap some classes in "namespace gfxstream::guest {}"
... to avoid more duplicate symbol definitions when
building Gfxstream VK ICD.

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:05:59 +00:00
Jason Macnak
e492b4aa53 Add dispatch magic for Gfxstream linux ICD
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:05:59 +00:00
Gurchetan Singh
1d560c1ee8 gfxstream: codegen EXT_swapchain_maintenance1 + KHR_swapchain host only
We really shouldn't be encoding/decoding EXT_swapchain_maintenance1
or KHR_swapchain at all, for Android.  The driver needs to expose
VK_ANDROID_native_buffer and Android's libvulkan implements swapchain
in terms of that.

However, Android's libvulkan doesn't filter out structs or definitions
related to those extensions, and for U, niether does gfxstream. That
means older images pass down the extensions.

Newer versions of gfxstream guest should do filtering and in fact
we have some host side filtering logic too.  So isolate the
extensions host side for now.

This also removes an abort(..) in unwrap_VkBindImageMemorySwapchainInfoKHR.
Since were aren't auto-generating KHR_swapchain anymore, so things don't
get copied, and the abort(..) gets triggered.

However, as gfxstream is not a validation layer, removing the abort is
harmless.

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:05:59 +00:00
Gurchetan Singh
6d7c47d3cd gfxstream: cereal: SUPPORTED_WRAPPERS --> SUPPORTED_MODULES
Wrappers are used to generate host and guest variants of
modules.  Thus, modules allow differentiation between guest
and host codegen, which wrappers do not.

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:05:59 +00:00
Gurchetan Singh
9193759bd3 gfxstream: cereal: [moduleType] --> [(moduleType, moduleName)]
It would be great if we could get the moduleName from
a moduleType, but couldn't determine how it's done.
So just create a tuple.

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:05:59 +00:00
Yahan Zhou
d9a71239b2 Use old en/decoding for vkQueueSignalReleaseImage
We accidentially changed the xml definition for
vkQueueSignalReleaseImageANDROID. As a result it changed its encoding
and decoding, which breaks Android emulator when launching old system
images (API level 29~32).

To fix this, we overwrite it with the old definition so that it keeps
using the old encoding/decoding.

Note that API 33+ uses vkQueueSignalReleaseImageANDROIDAsyncGOOGLE which
does not have this problem.

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:05:59 +00:00
C Stout
7ff621cf19 [guest] Add skeleton Fuchsia VirtGpu implementation
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:05:59 +00:00
Jason Macnak
cb5e7213d5 Use libbase's property getting functions
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:05:59 +00:00
C Stout
c80f355101 [guest] Fix Fuchsia build
Major changes:
- remove QemuPipeStreamFuchsia
- reinstate processPipeDoInit() for initSeqno(), but skip the rest
- revamp the .gn build file

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:05:59 +00:00
Jason Macnak
6227db5ad8 Promote testing framework to a proper platform backend
... which helps to enable building a Gfxstream VK ICD which runs
the host server in-process and can be used for testing with
regular apps (so things outside of the End2End tests). This also
helps to minimize the amount of the things that the End2End tests
are configuring.

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:05:59 +00:00
C Stout
cecd8abbdd Exclude Android entry points on Fuchsia
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:05:59 +00:00
C Stout
aa3fdb3ebf Fix dispatchable object layout on Fuchsia
Partial revert of 650c0c033aceede8f1eb6088c9fe7fbceba1c34b.

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:05:59 +00:00
Gurchetan Singh
07d7882a80 gfxstream: look for common/opengl headers
Probably "Make GL header lib and update libs to explicitly
depend on it" broke the meson build.

In file included from ../renderControl_enc/renderControl_types.h:19,
                 from ../renderControl_enc/renderControl_client_proc.h:8,
                 from ../renderControl_enc/renderControl_client_context.h:6,
                 from ../renderControl_enc/renderControl_enc.h:9,
                 from ../vulkan_enc/../OpenglSystemCommon/HostConnection.h:25,
                 from ../vulkan_enc/ResourceTracker.cpp:19:
../OpenglCodecCommon/glUtils.h:46:10: fatal error: GLES/gl.h: No such file or directory

Long term, we should nuke renderControl and GL dependencies through
compile options (GOLDFISH_NO_GL) for example.

     ninja -C amd64-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:05:59 +00:00
Jason Macnak
ff6d914b9b Move info maps into ResourceTracker
... to avoid more globals.

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:05:59 +00:00
Gurchetan Singh
8a43302850 gfxstream: use standard Vulkan headers and new auto-gen flow
This modifies gfxstream to use standard Vulkan headers,
and updates to 1.3.269.

Previously, the headers were mostly standard, but added in
vk_android_native_buffer into vulkan_core.h.  That breaks down
when using auto-gen scripts from outside gfxstream, which will
happen in a subsequent patchset.

For vk_native_buffer_android, we can simply provide a
vk_android_native_buffer_gfxstream.h.

Long-term, vk_native_buffer_android.h should be deprecated in
favor of VK_ANDROID_external_memory_android_hardware_buffer, in
Android's libvulkan and elsewhere.

For the Vulkan headers, the new procedure is generate them in the
directions found here in the following repos:

https://github.com/KhronosGroup/Vulkan-Headers
https://github.com/KhronosGroup/Vulkan-Hpp

Those headers can be copied over using cp.  For gfxstream encoder
+ decoders, that's still generated via ./generate-gfxstream-vulkan.sh

The only catch is you must use the same vk.xml for Vulkan-Headers,
Vulkan-Hpp, and for the cereal generator.  The recommended flow
is use whatever the xml is in Vulkan-Headers ToT and copy to
Vulkan-Hpp and cerealgenerator.py before running those scripts.

The End2End tests that relied on vk_android_native_buffer were
also modified.  Long-term, the AHB extension could be used
instead of ANB for 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:05:59 +00:00
Gurchetan Singh
c26f73317b gfxstream: add support for VK_KHR_maintenance5 + VK_EXT_host_image_copy
In newer versions of vk.xml, VK_EXT_host_image_copy also
provides vkGetImageSubresourceLayout2EXT.  Autogen for
VK_EXT_host_image_copy fails without VK_KHR_maintainance5.

For some reason, onGenCmd(..) for vkGetImageSubresourceLayout2EXT
is requires VK_EXT_host_image_copy.  This goes back into reg.py
in vulkan-docs.

Interestingly, the Android's libvulkan doesn't use
vkGetImageSubresourceLayout2EXT, nor does it check for
VK_EXT_image_compression_control before using it.

https://android-review.googlesource.com/c/platform/frameworks/native/+/2016419

Thus, we can have VK_EXT_host_image_copy provide the function.

Maybe we can revert this if the function isn't used by libvulkan
aswell.

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:05:59 +00:00
Gurchetan Singh
1b8e1d100e gfxstream: add generate-gfxstream-vulkan.sh
Simpler version of the generate-vulkan-sources.sh
script.

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:05:59 +00:00
Gurchetan Singh
3ec593d9cd gfxstream: vulkan-docs: don't auto-generate vk_android_native_buffer
We shouldn't autogenerate this header, since it's a forked header
specific to gfxstream.

Plus, this particular extension is disabled in the Vulkan anyways,
and used between Android libvulkan <--> ICD only.

We should just call it "vk_android_native_buffer_gfxstream.h" to
avoid namespace conflicts.

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:05:58 +00:00
Gurchetan Singh
c1887f0dbf gfxstream: genvk: add support for vk_gfxstream.xml
Custom XML file specific to 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:05:58 +00:00
Gurchetan Singh
f0fc91acff gfxstream: vulkan-docs: add cereal generator
This adds custom the cereal generator as an option to genvk.py
gfxstream specific options like "-registryGfxstream" are also
added.

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:05:58 +00:00
Gurchetan Singh
bd8eb080ff gfxstream: vulkan-docs: track feature type
The newest version of Vulkan docs doesn't have this, and it
needs to be patched in.

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:05:58 +00:00
Gurchetan Singh
82ff5f769f gfxstream: vulkan-Docs: import the cerealgenerator
This imports the cereal generator into the next gen
Vulkan docs.

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:05:58 +00:00
Gurchetan Singh
c10d78e61e gfxstream: import Vulkan-docs from 463f8c
This is based on 463f8c ("Change log for October
20, 2023 Vulkan 1.3.269 spec update").

Right now, the current version of vulkan-docs seems to
be 2021.  Need to update.  Import here without
modifications so we can track the changes that were
needed to support cereal.

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:05:58 +00:00
C Stout
21b028e0c9 Reapply "[guest] Check that the singleton VirtGpuDevice matches desired capset"
This reverts commit e5040938cd3947d0efaa287b2a509b879bee56bb.

Add special handling for kCapsetNone: return a device that was created
with any capset.

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:05:58 +00:00
Jason Macnak
b0d19974f5 Revert "[guest] Check that the singleton VirtGpuDevice matches desired capset"
This reverts commit e08334cde39bbb8142caf42e716a5e11f772ce1a.

Reason for revert: breaks dEQP testing b/309836674

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:05:58 +00:00
C Stout
ade1fcea63 [guest] Check that the singleton VirtGpuDevice matches desired capset
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:05:58 +00:00
Yahan Zhou
822c88f173 VkImageCreateInfo should ignore queeu family indices in some situation
The spec says indices pointer should be ignored when sharingMode is not
VK_SHARING_MODE_CONCURRENT.

We need to explicitly set index count to 0 and index pointer to null,
otherwise encoder will still try to encode it.

Spec:

https://registry.khronos.org/vulkan/specs/1.3/html/vkspec.html#VUID-VkBufferCreateInfo-sharingMode-00913

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:05:58 +00:00
Gurchetan Singh
00d26a31fa gfxstream/guest: pass through Android process names
This allows complex process names such as "com.android.systemui"
and "android.hardware.graphics.composer3-service.ranchu" to be
be the debug name via the virtio-gpu interface.

This uses the CONTEXT_INIT ioctl to pass through the name.  Due
to TASK_COMM_LEN and the fact we initialize many times using
"RenderThread", the process name wasn't always propagated through
before.

This is useful for debugging and a host composition flow as well.

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:05:58 +00:00
Yahan Zhou
28d5e2d777 Fix dEQP-VK.wsi.android.maintenance1
- There is a bug in the wait implementation.
 - We should not send VK_IMAGE_LAYOUT_MAX_ENUM to host.

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:05:58 +00:00
Yahan Zhou
c5a8e9bee4 Disable compatible handle types for semaphore timeline
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:05:58 +00:00
Andrew Woloszyn
66d9bf1a8c Fix for dynamic rendering.
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:05:58 +00:00
Yahan Zhou
a43de793fc Parse more ext structs in vkAllocateMemory and vkCreateBuffer
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:05:58 +00:00
Yahan Zhou
ba5cb9b65c Create sync device before calling goldfish_sync_queue_work
dEQP-VK.wsi.android.maintenance1.* becomes flaky (instead of hard
failure) after the fix.

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:05:58 +00:00
Andrew Woloszyn
1019e5d4d8 Added some fixes for zircon tests in the Android CTS.
We shouldn't have been trying to run the tests in the first place
but vkGetPhysicalDevice*Properties was returning true for these
handles even on Android.

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:05:58 +00:00
Yahan Zhou
d9e47cb1e0 Add some vk 1.3 extension strings
Note: nVidia has a driver bug with vkGetPrivateData. But swiftshader
works fine.

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:05:58 +00:00
Gurchetan Singh
8d7e6cbf6e gfxstream: fix meson build system issues
- Fix aemu_logging pkg-config dependency after
  aosp/2754786

- Fix path to virtio-gpu-gfxstream-renderer.h after
  aosp/2755688

- Fix dependencies on <GL/gl.h> in both guest and host
  builds.

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:05:58 +00:00
Gurchetan Singh
df2b17c4b8 gfxstream: nuke ResourceTracker::Impl
The big giant Vulkan singleton might have an underlying
implementation.  However, it's unlikely we'll have more than
impl since it it's pretty giant.  Nuke ResourceTracker::Impl
to reduce the number of layers one must traverse to modify
things.

Since this was mega-change, clang-format was also applied.

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:05:58 +00:00
Jason Macnak
0e8582d6da Move SyncHelper to platform
... upcoming changes will add promote the emulated virtio gpu
stack as a proper platform backend which will include the
SyncHelper.

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:05:58 +00:00
Gurchetan Singh
f321c3e997 gfxstream: don't use renderControlEnc for Vulkan
Based on host caps.

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:05:58 +00:00
Gurchetan Singh
280eef5b65 gfxstream: simplify VK_HOST_CONNECTION macro
Try to do most of the work in SetupInstance.

     vulkaninfo Linux guest

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:05:58 +00:00
Gurchetan Singh
22eba755ad gfxstream: nuke unused functions
These functions are unused.

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:05:58 +00:00
Gurchetan Singh
a026b5d20f gfxstream/guest: use GetRingParamsFromCapset
Use the previously mentioned GetRingParamsFromCapset 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:05:58 +00:00
Gurchetan Singh
13946ba27b gfxstream/guest: add GetRingParamsFromCapset function
Every capset provides ASG ring metadata.  Have a function for
that.

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:05:58 +00:00
Gurchetan Singh
7bfcb8d0e0 gfxstream: query non-Vulkan caps from the guest
In case the guest starts asking for them.  Will likely be added in
the future.

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:05:58 +00:00