commit | 1659da36c084078be8f90c0867fb0b243008be34 | [log] [tgz] |
---|---|---|
author | Bo Hu <bohu@google.com> | Tue Oct 08 13:50:52 2024 -0700 |
committer | Bo Hu <bohu@google.com> | Wed Oct 09 22:04:40 2024 -0700 |
tree | 218ac764731bd93c2303f2c71df855239057a672 | |
parent | 92bd6da76847daeb783272b0333923397fa8a3df [diff] |
[Vulkan Snapshot]: handle multi-allocation better Do not delete the ApiInfo that keeps the trace to create multiple Vulkan Objects, if it still has some objects left in its createdHandles. Only do that after all the handles are removed, so that the remaining handles will still be loaded and usable; Otherwise, the emulator will crash later on if one of the handles is used. This will potentiall lead to resource leakage, and it should be handled shortly. Test: create an vulkan app, allocate command buffers in one batch, e.g, 4, free the last command buffer; use the remaining 3 for rendering and save snapshot; it should not crash in save and it should load fine. Bug: 372242705 Change-Id: If671e95acae9cf49e490d9e46ad393cddf6a3e49
Graphics Streaming Kit (colloquially known as Gfxstream) is a code generator that makes it easier to serialize and forward graphics API calls from one place to another:
The latest directions for the standalone Linux build are provided here.
Make sure the latest CMake is installed. Make sure Visual Studio 2019 is installed on your system along with all the Clang C++ toolchain components. Then:
mkdir build cd build cmake . ../ -A x64 -T ClangCL
A solution file should be generated. Then open the solution file in Visual studio and build the gfxstream_backend
target.
Be in the Android build system. Then:
m libgfxstream_backend
It then ends up in out/host
This also builds for Android on-device.
libgfxstream_backend.(dll|so|dylib)
To re-generate both guest and Vulkan code, please run:
scripts/generate-gfxstream-vulkan.sh
First, build build/gfxstream-generic-apigen
. Then run:
scripts/generate-apigen-source.sh
There are a bunch of test executables generated. They require libEGL.dll
and libGLESv2.dll
and vulkan-1.dll
to be available, possibly from your GPU vendor or ANGLE, in the %PATH%
.
There are Android mock testa available, runnable on Linux. To build these tests, run:
m GfxstreamEnd2EndTests
The host renderer has optional support for Perfetto tracing which can be enabled by defining GFXSTREAM_BUILD_WITH_TRACING
(enabled by default on Android builds).
The perfetto
and traced
tools from Perfetto should be installed. Please see the Perfetto Quickstart or follow these short form instructions:
cd <your Android repo>/external/perfetto ./tools/install-build-deps ./tools/gn gen --args='is_debug=false' out/linux ./tools/ninja -C out/linux traced perfetto
To capture a trace on Linux, start the Perfetto daemon:
./out/linux/traced
Then, run Gfxstream with Cuttlefish:
cvd start --gpu_mode=gfxstream_guest_angle_host_swiftshader
Next, start a trace capture with:
./out/linux/perfetto --txt -c gfxstream_trace.cfg -o gfxstream_trace.perfetto
with gfxstream_trace.cfg
containing the following or similar:
buffers { size_kb: 4096 } data_sources { config { name: "track_event" track_event_config { } } }
Next, end the trace capture with Ctrl + C.
Finally, open https://ui.perfetto.dev/ in your webbrowser and use “Open trace file” to view the trace.
gfxstream vulkan is the most actively developed component. Some key commponents of the current design include:
struct gfxstream_vk_device
and the gfxstream object goldfish_device
both are internal representations of Vulkan opaque handle VkDevice
. The Mesa object is used first, since Mesa provides dispatch. The Mesa object contains a key to the hash table to get a gfxstream internal object (for example, gfxstream_vk_device::internal_object
). Eventually, gfxstream objects will be phased out and Mesa objects used exclusively.