There is currently a problem of missed setevent
and that leads to wait event hangs, or queue becomes
not able to idle, no matter how long it is waited upon.
To solve this problem, this cl follows each event's set,
reset, and save the set status into snapshot.
Later one, during loading, it recovers their set status,
so that subsequent cmd event wait can continue.
specifically, the following steps are taken:
1, set and reset operations from host or
in the queue are tracked.
2, if an event is set, that status will be saved
into snapshot; later during loadiing, the set operation
will be set again from the host or in the same queue
before snapshot.
This is not complete, but it is a first step
to resolve some of the timeout issue.
TODO:
event2
Test: xr should not hang during save due to
queue gets blocked (vkQueueSubmit does not return,
or wait for fence times out)
Bug: 417788798
Change-Id: I991cccfb2f34c6189f6c0759b8abbb365b695719
Improve readability of the code by removing some of the
unnecessary parentheses in the generated code.
(regen auto generated code)
Bug: 329094533
Test: CI
Change-Id: I8c29b49cb58310c70820421e1fd3abea8bd00a92
Avoid nullptr from zero-size allocations being passed
into the copy functions, which is causing UB errors.
(regen auto generated code)
Bug: 329094533
Test: CI
Change-Id: I9d5a76f58585449d333ce56539e877ecb47c63e6
... as VkSnapshotApiCallInfo* is a pointer into a
std::vector<VkSnapshotApiCallInfo> which can be invalidated during
multi threaded VK usage when the std::vector<> is resized.
Bug: b/422483825
Test: bazel test common/end2end:gfxstream_end2end_tests \
--graphics_drivers=gles_angle_vulkan_swiftshader \
--test_arg="--gtest_filter=*MultiThreadedResetCommandBuffer*VulkanSnapshots*" \
--test_arg="--gtest_repeat=100" \
--test_output=streamed
Change-Id: I8ea16eea8792b11056d6d7f17e370f9aa045406c
.. after recent changes on the build script due to xml file
location change.
Bug: 417150515
Test: CI
Change-Id: I04b2e40778fc8f2c832a4c9204a411fe9895dd08
Includes a small change to keep using MTLResource_id
which actually didn't make it into the spec.
A typo fix in vulkansc_raii.hpp
Fixes on end2end tests for vulkanhpp changes.
Change to enable comparison operators on handles even when
the spaceship operator is available, to avoid errors on
old compilers where they are not generated.
Bug: 417150515
Test: CI
Test: dEQP-VK.api.info.vulkan1p2
Test: atest GfxstreamEnd2EndTests
Change-Id: Ic9b9256541dde50b77c4d6d63d277bc222a64157
Moves several of the "common/base" classes to host/backend as these
classes all used `Stream` which is a host only interface.
Bug: b/403363880
Test: cd hardware/google/gfxstream
mma
Test: cd hardware/google/gfxstream
mkdir build && cd build
cmake .. -G Ninja
ninja
Test: meson setup \
-Ddefault_library=static \
-Dgfxstream-build=host \
build
meson compile -C build
Test: cd <emu main dev repo>
cd external/qemu
python android/build/python/cmake.py --gfxstream
Test: cd <emu main next repo>
prebuilts/bazel/linux-x86_64/bazel test \
--platforms=@//build/bazel/platforms:linux_x64 \
@gfxstream//...
Change-Id: Ia664776c2322b310614f632e4926bb3b031f3bc1
In common cases, command buffer is recorded
right before submission. re-submission of pre-recorded
command buffer multiple times is uncommon.
However, it is still a valid case that should be properly
handled by snapshot save and load.
This cl adds code inside SubDecoder to track the dependency
of each Cmd, and also snapshot save and load vkQueueFlushCommandsGOOGLE.
Bug: 415349936
Change-Id: I11b462203722518ea82609613c0874d07bf5be53
NO_IFTTT=existing field covered with type change
Bug: b/403363880
Test: cd hardware/google/gfxstream
mma
Test: cd hardware/google/gfxstream
mkdir build && cd build
cmake .. -G Ninja
ninja
Test: meson setup \
-Ddefault_library=static \
-Dgfxstream-build=host \
build
meson compile -C build
Test: cd <emu master dev repo>
cd external/qemu
python android/build/python/cmake.py --gfxstream
Test: cd <emu main next repo>
prebuilts/bazel/linux-x86_64/bazel test \
--platforms=@//build/bazel/platforms:linux_x64 \
@gfxstream//...
Change-Id: I6bfb2c4ef8368799d9f99f6293d9762b7dcb4c7f
... to eventually replace the existing host-common/logging. This
is needed to break up the circular dependency between aemu-base and
aemu-host-common, so that we can move parts of aemu-base and
aemu-host-common into hardware/google/gfxstream, in order to make
Gfxstream a self contained library for building.
Hooks up the existing host-common/logging via the
RenderLibImpl::setLogger() call.
Bug: b/403363880
Test: cd hardware/google/gfxstream
mma
Test: cd hardware/google/gfxstream
mkdir build && cd build
cmake .. -G Ninja
ninja
Test: meson setup \
-Ddefault_library=static \
-Dgfxstream-build=host \
build
meson compile -C build
Test: cd <emu master dev repo>
cd external/qemu
python android/build/python/cmake.py --gfxstream
Test: cd <emu main next repo>
prebuilts/bazel/linux-x86_64/bazel test \
--platforms=@//build/bazel/platforms:linux_x64 \
@gfxstream//...
Change-Id: Id52c6f756f85d0a5fb948601228234d7a84a14c2
Adds validity conditioning before making driver calls
to be able to handle some fatal errors later on.
Bug: 383272733
Test: CI
Change-Id: Ie9898aeb9f15ad5388ee9db21559233eb43b5053
... so that `VkDecoderGlobalState` can append additional information
needed for snapshotting. Specifically, `VkDecoderGlobalState` may create
additional boxed handles that are not visible directly in the API surface.
For example, `vkCreateDevice()` creates boxed handles for the `VkQueue`-s
and `vkCreateDescriptorPool()` creates boxed handles for pre-allocated
`VkDescriptorSets`. These boxed handles are not recoverable from the API
for `vkCreateDevice()` nor `vkCreateDescriptorPool()` directly. This was
previously worked around by just sticking the extra boxed handles in
`VkReconstruction::mExtraHandlesForNextApi` but this is not thread safe.
Instead, let's give `VkDecoderGlobalState` and `VkDecoderSnapshot` exclusive
access to individual `VkSnapshotApiCallInfo` objects.
Bug: b/383139165
Test: cvd create --gpu_mode=gfxstream_guest_angle_host_swiftshader
Change-Id: I158b12d38584ca964af841e77d1d58a9f6901613
Add missing alias for the vkCmd function to the vk.xml to be
able to use it correctly at the host side decoder and subdecoder.
Bug: 357829977
Test: dEQP-VK.dynamic_state.monolithic.line_width.
Change-Id: If81e932ae9527eab8d0b09e2c3446f2f4c526bc6
With Mesa in the Emulator manifest, all Google projects
can just run codegen from that directory.
It has a deeper Git history, but the biggest win of the
dual upstream strategy is it only implies two levels
of synchronization:
1) mesa -> AOSP mesa (doable via Skia autorollers, other teams do
it)
2) AOSP main -> mesa (doable by a rotation of even long-term Gitlab
CI bot)
(2) depends on the volume of commits, which data indicates is
5/per month maybe.
BUG=374306378
TEST=CI
Change-Id: I667e2b4518837326c13cbac4af6d6d2ea7402112
With recent mesa related changes, we started using a recent version of
vk.xml and this promoted extension was being used as EXT in our codegen
scripts. This resulted in some code loss, skips on pNext chain of
commands sent from the guest side and eventually CTS/dEQP failures.
Updating vulkan headers partially with this change to accomodate KHR
version of the extension correctly.
Bug: b/357832421
Test: dEQP-VK.api.info.vulkan1p2_limits_validation*
Change-Id: I53fbb2742a846dbce55080deb46f5e4fd46e6c11
We have two versions of the same code, and we keep it
in sync via batch updates.
BUG=369906368
TEST=CI
Change-Id: I6852092fdd9e8a72d9921e693870722337c376cb
Mostly just change the locations of directories.
One exception is aosp/3271678, which needs to land in the
Mesa codegen directory.
For workflows without an AOSP tree, one can just pass in
the path to Mesa tree.
Mesa uses a newer version of vk.xml than the host does,
so some changes are observed.
BUG=369200554
TEST=generate-gfxstream-vulkan.sh in AOSP
or
cd ~/
git clone https://gitlab.freedesktop.org/mesa/mesa.git
cd ${gfxstream_dir}
./scripts/generate-gfxstream-vulkan.sh ~/mesa
Change-Id: I5a023ed4d8788a31f352d017f321656c7b7a7410
... to aid debugging.
Bug: b/364967041
Test: cvd start --gpu_mode=gfxstream_guest_angle_host_swiftshader
Test: perfetto capture and open in ui.perfetto.dev
Change-Id: Ieda7f9ce8d0a0923a989cd201438819568cab140
Unboxing fails if a NULL handle is passed in, triggering an abort.
However for vkCmdBeginTransformFeedbackEXT, this is perfectly
valid:
"For each element of pCounterBuffers that is VK_NULL_HANDLE,
transform feedback will start capturing vertex data to byte zero
in the corresponding bound transform feedback buffer."
BUG=349122558
TEST=run gfxbench manhattan_off on Intel
Change-Id: I62f2572ee637f0f9f72796fabdd64a7b3cc53006
Add VK_KHR_ray_tracing_pipeline and VK_KHR_pipeline_library
extensions support which are used by some test applications.
Bug: 351729443
Test: run benchmark tests on MacOS
Change-Id: Ice76fbc1b431b6ee74b8df587719fe4f13f457a8
Reduce clutter due to extensions related ifdef code block generation
and avoid changing many files when a new extension support is added
with partial functionality.
Test: run ./scripts/generate-gfxstream-vulkan.sh
Bug: 332482903
Change-Id: I8cb6ca546eb63746283eff14f0440c4aa68f0dc5
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.
Bug: 333460957
Test: run with swiftshader, host and use-host-vulkan arguments on MacOS
Change-Id: I17ce958bc6498029ad4c525e80764060f88df118
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.
Bug: b/332482903
Test: Run Khronos Vulkan samples
Change-Id: I474ad10ce36bc248d9e70210a7eee4d948197782
MoltenVK extension code was not being generated because of the
missing "supported=vulkan" tag required by the code generator.
Bug: 332964912
Bug: 339094207
Test: build and run with -use-host-vulkan mode
Change-Id: I923c0cb6f3438b4b3aa3c102098cdcb01f7b6700
Adding VK_EXT_metal_objects to the supported extensions
for the host side operations.
Bug: 332964912
Test: build
Change-Id: I8fbad4316be16e2981ca6de9bea6fc505b4fd59e
This extension is required to get Vulkan Capabilities
Viewer working correctly in the emulator.
Bug: 327501571
Test: Run vk caps viewer on the emulator
Change-Id: Ie59eb0188285f0147f4f1aa642fb69593b330c35
This is another extension used for vulkan validation.
Bug: 327501571
Test: Build & run an app with validation layers
Change-Id: I5fbd7c53176b19a40f2191b6e6697146907a4dad
Sometimes guest renders to an AHB without calling
vkQueueSignalReleaseImageANDROIDAsyncGOOGLE. This would result in the
color buffer not being updated from Vulkan.
This commit tracks the situation that AHB is rendered to, and copies its
content to color buffer.
Note that it adds extra wait, which could hurt performance.
Bug: 327522469
Test: run Chrome with -gpu swiftshader
Change-Id: I3687a68eb222039291c6f73fc65fb0e9ec0b443b
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.rsthttps://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.
BUG=313466265
BUG=298679844
TEST=
* 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
Change-Id: Ic4cc50d5098dddd77c9265afa8f432a2fdea8845
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-Headershttps://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.
BUG=310206667
TEST=launch_cvd --gpu_mode=gfxstream_guest_angle
Change-Id: Ib43d8555cf37a9e9a7189ec7597f78f12cd53b5d
It is used in this test:
dEQP-VK.pipeline.pipeline_library.graphics_library.fast.4
Note that the test is supposed to check for extension support before
using the extension, but the check doesn't seem to work.
Bug: 307550200
Test: dEQP-VK.pipeline.pipeline_library.graphics_library.fast.4
Change-Id: I3fa8ef493a455e7dd342bbce4795a83041d1e15f
This a reland of aosp/2730996 (host).
Host side landing of prior change. Separating them out is useful
for testing.
BUG=298704840
TEST=compile
Change-Id: I5783e7e2ea63bbf72b757d00d4126855659f1b19