1# Graphics Streaming Kit (formerly: Vulkan Cereal) 2 3Graphics Streaming Kit is a code generator that makes it easier to serialize 4and forward graphics API calls from one place to another: 5 6- From a virtual machine guest to host for virtualized graphics 7- From one process to another for IPC graphics 8- From one computer to another via network sockets 9 10# Build: Linux 11 12Make sure the latest CMake is installed. 13Make sure the opengl lib is installed. Otherwise, sudo apt-get install 14libglu1-mesa-dev freeglut3-dev mesa-common-dev 15Make sure you are using Clang as your `CC` and clang++ as your`CXX`. Then 16 17 mkdir build 18 cd build 19 cmake . ../ 20 make -j24 21 22Unit tests: 23 24 make test 25 26# Build: Windows 27 28Make sure the latest CMake is installed. Make sure Visual Studio 2019 is 29installed on your system along with all the Clang C++ toolchain components. 30Then 31 32 mkdir build 33 cd build 34 cmake . ../ -A x64 -T ClangCL 35 36A solution file should be generated. Then open the solution file in Visual 37studio and build the `gfxstream_backend` target. 38 39# Build: Android for host 40 41Be in the Android build system. Then 42 43 m libgfxstream_backend 44 45It then ends up in `out/host` 46 47This also builds for Android on-device. 48 49# Output artifacts 50 51 libgfxstream_backend.(dll|so|dylib) 52 53# Regenerating Vulkan code 54 55Check out the [gfxstream-protocols](https://android.googlesource.com/platform/external/gfxstream-protocols/) 56repo at `../../../external/gfxstream-protocols` relative to the root directory of this repo, and 57run the `scripts/generate-vulkan-sources.sh` script in the `gfxstream-protocols` root folder. 58 59If you're in an AOSP checkout, this will also modify contents of the guest Vulkan encoder in `../goldfish-opengl`. 60 61# Regenerating GLES/RenderControl code 62 63First, build `build/gfxstream-generic-apigen`. Then run 64 65 scripts/generate-apigen-source.sh 66 67# Tests 68 69## Linux Tests 70 71There are a bunch of test executables generated. They require `libEGL.so` and `libGLESv2.so` and `libvulkan.so` to be available, possibly from your GPU vendor or ANGLE, in the `$LD_LIBRARY_PATH`. 72 73## Windows Tests 74 75There 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%`. 76 77## Android Host Tests 78 79These are currently not built due to the dependency on system libEGL/libvulkan to run correctly. 80 81# Structure 82 83- `CMakeLists.txt`: specifies all host-side build targets. This includes all 84 backends along with client/server setups that live only on the host. Some 85 - Backend implementations 86 - Implementations of the host side of various transports 87 - Frontends used for host-side testing with a mock implementation of guest 88 graphics stack (mainly Android) 89 - Frontends that result in actual Linux/macOS/Windows gles/vk libraries 90 (isolation / fault tolerance use case) 91- `Android.bp`: specifies all guest-side build targets for Android: 92 - Implementations of the guest side of various transports (above the kernel) 93 - Frontends 94- `BUILD.gn`: specifies all guest-side build targets for Fuchsia 95 - Implementations of the guest side of various transports (above the kernel) 96 - Frontends 97- `base/`: common libraries that are built for both the guest and host. 98 Contains utility code related to synchronization, threading, and suballocation. 99- `protocols/`: implementations of protocols for various graphics APIs. May contain 100code generators to make it easy to regen the protocol based on certain things. 101- `host-common/`: implementations of host-side support code that makes it 102 easier to run the server in a variety of virtual device environments. 103 Contains concrete implementations of auxiliary virtual devices such as 104 Address Space Device and Goldfish Pipe. 105- `stream-servers/`: implementations of various backends for various graphics 106 APIs that consume protocol. `gfxstream-virtio-gpu-renderer.cpp` contains a 107 virtio-gpu backend implementation. 108