gfxstream for DroidVM: Gunyah GuestAccept blob path + host-visible arena
  • C++ 92.6%
  • C 3.9%
  • Python 1.7%
  • Starlark 0.6%
  • CMake 0.4%
  • Other 0.7%
Find a file
HuJK d3d42c1440 gfxstream: host-visible arena config scaffold (task #15)
First increment of the production arena that blesses host-visible memory once
and recycles it, killing the per-BO share/unshare churn behind RM EPERM /
poisoning / long-uptime crashes.

- HostVisibleArena.h: env config (GFXSTREAM_ARENA_MB budget,
  GFXSTREAM_ARENA_THRESHOLD_KB size gate: 0=all-dynamic/off,
  -1=all-arena/strict-OOM-on-full, >0=hybrid) + routesToArena() decision.
- Wired into the udmabuf host-visible branch of on_vkAllocateMemory: parses
  once, logs the mode, computes the per-alloc routing decision.  Default
  config (threshold 0) is a no-op -> behavior unchanged.  Builds clean.

Next: the blessed folio-backed recycle pool (generalizing the RingBlob
MADV_COLLAPSE pool) that acts on the routing decision, then v2 offset
suballocation (guest gfxstream_vk CoherentMemory).  Grounded plan +
confirmed active path in GFXSTREAM_ARENA_PLAN.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Smu6N2o945D86k4hE1i9jr
Change-Id: I2c50fa8e3e9cccaa55386e0a1b2cc8e7d5902a0f
History 2026-07-11 19:03:32 +08:00
.config Update disk cache usage 2025-06-26 01:02:21 +00:00
.github Add emulated physical memory tests to presubmit 2025-08-28 23:50:47 +00:00
.kokoro Add CtsGraphicsTestCases and CtsNativeHardwareTestCases to kokoro 2025-07-31 02:03:25 +00:00
codegen Fix some log messages 2025-07-25 22:20:02 +00:00
common Remove unused CStrWrapper 2025-09-12 16:55:13 +01:00
docs Finish setting up bazel build for end2end tests 2025-05-19 08:45:22 -07:00
guest Link perfetto after ag/35183899 2025-09-04 19:31:59 +00:00
host gfxstream: host-visible arena config scaffold (task #15) 2026-07-11 19:03:32 +08:00
scripts Provide python version of shader generation script 2025-09-04 19:31:59 +00:00
tests end2endtests: kumquat --> kumquat_virtio 2025-09-11 15:05:40 -07:00
third_party end2endtests: kumquat --> kumquat_virtio 2025-09-11 15:05:40 -07:00
toolchain Run apt-get update during dep install 2025-08-26 17:51:34 +00:00
.bazelrc Reland "Support running end2end tests with locally built..." 2025-05-23 09:57:46 -07:00
.clang-format Initial copy from hardware/google/gfxstream 2025-05-23 20:37:51 +00:00
.gitignore Ignore bazel directories 2025-03-21 11:04:42 -07:00
Android.bp Enable alwaysBlob 2025-07-25 07:10:34 -07:00
BUILD.bazel Explicitly link subdirectories to top level license 2025-05-30 15:40:14 +00:00
build_variables.bzl Disable thread-safety warnings globally 2025-07-10 17:38:09 +00:00
CMakeLists.txt Implement macos codepath for display surface creation 2025-09-04 19:31:59 +00:00
CONTRIBUTING.md Cleanup third party 2025-05-08 12:17:50 -07:00
LICENSE Update LICENSE to just apache2 2025-05-20 15:49:56 -07:00
meson.build Enable alwaysBlob 2025-07-25 07:10:34 -07:00
meson_options.txt More findings from release tool 2025-05-09 10:22:46 -07:00
MODULE.bazel Demote absl to just a dev dependency 2025-05-27 13:49:05 -07:00
MODULE.bazel.lock Move end2end tests to the new tests subdirectory 2025-07-28 21:03:30 +00:00
MODULE_LICENSE_APACHE2 Add metadata files 2022-02-11 01:40:15 -08:00
OWNERS Add more owners from emu-dev team. 2025-04-17 11:04:39 -07:00
README.md Move end2end tests to the new tests subdirectory 2025-07-28 21:03:30 +00:00
REPO.bazel Cleanups to make internal build happy 2025-05-28 23:23:49 +00:00

Gfxstream

Graphics Streaming Kit, colloquially known as Gfxstream and previously known as Vulkan Cereal, is a collection of code generators and libraries for streaming rendering APIs from one place to another.

  • From a virtual machine guest to host for virtualized graphics
  • From one process to another for IPC graphics
  • From one computer to another via network sockets

Building

Linux

Bazel

The Bazel build current supports building the host server which is typically used for Android virtual device host tooling.

cd <gfxstream project>

bazel build ...

bazel test ...

CMake

The CMake build has historically been used for building the host backend for Goldfish.

The CMake build can be used from either a standalone Gfxstream checkout or from inside an Android repo.

Then,

mkdir build

cd build

cmake .. -G Ninja

ninja

For validating a Goldfish build,

cd <aosp/emu-main-dev repo>

cd external/qemu

python android/build/python/cmake.py --gfxstream

Meson

The Meson build has historically been used for building the backend for Linux guest on Linux host use cases.

cd <gfxstream project>

meson setup \
    -Ddefault_library=static \
    -Dgfxstream-build=host \
    build

meson compile -C build

Soong

The Android Soong build is used for building the guest components for virtual device (Cuttlefish, Goldfish, etc) images and was previously used for building the host backend for virtual device host tools.

Please follow the instructions here for getting started with Android development and setting up a repo.

Then,

m libgfxstream_backend

and libgfxstream_backend.so can be found in out/host.

For validating changes, consider running

cd hardware/google/gfxstream

mma

to build everything inside of the Gfxstream directory.

Windows

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.

Codegen

Regenerating GLES/RenderControl code

Run:

scripts/generate-apigen-source.sh

Regenerating Vulkan code

To re-generate both guest and Vulkan code, please run:

scripts/generate-gfxstream-vulkan.sh

Testing

Linux

Bazel

bazel test ...

or

bazel test tests/end2end:gfxstream_end2end_tests

Soong

From within an Android repo, run:

atest --host GfxstreamEnd2EndTests

Windows

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%.

Notice

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.