Skip to content

Repository files navigation

bionic-fg

implicit Vulkan frame generation layer for linux x86/x86-64/arm64/android

Runtime configuration

The Vulkan layer is enabled with BIONIC_FG_ENABLE=1 and reads a TOML config file. The config path defaults to $HOME/.config/bionic-fg/conf.toml and can be overridden with BIONIC_FG_CONFIG.

BIONIC_FG_ENABLE=1
BIONIC_FG_CONFIG=/path/to/conf.toml # optional
VK_LAYER_PATH=/path/to/implicit_layer.d
version = 1

[global]
enabled = true
multiplier = 2   # 0=off, or 2..4
flow_scale = 0.8 # 0.2..1.0
model = 0        # 0 or 1

BIONIC_FG_MULTIPLIER, BIONIC_FG_FLOW_SCALE, and BIONIC_FG_MODEL are accepted when the TOML file is missing. If the TOML file exists, it wins.

The layer polls the config file timestamp during presentation.

  • flow_scale hot-reloads in place.
  • multiplier and model hot-reload by rebuilding the internal framegen context against the already-provisioned AHB outputs and swapchain image pool. Setting multiplier = 0 turns frame generation off without recreating the app swapchain.
  • On Android/Bionic and glibc builds, enabled hot-reloads in place by creating or destroying the framegen context against the swapchain resources provisioned at swapchain creation. Other targets use a one-time VK_ERROR_OUT_OF_DATE_KHR fallback when the swapchain was not provisioned for hot reload.

Install layout expected by the manifest:

.local/lib/libbionic_fg.so
.local/lib/i386-linux-gnu/libbionic_fg.so
.local/share/vulkan/implicit_layer.d/VkLayer_BIONIC_framegen.json
.local/share/vulkan/implicit_layer.d/VkLayer_BIONIC_framegen_i386.json

The 64-bit manifest uses ../../../lib/libbionic_fg.so and the 32-bit compatibility manifest uses ../../../lib/i386-linux-gnu/libbionic_fg.so, relative to implicit_layer.d. Both manifests advertise the same layer name; the Vulkan loader selects the one matching the application process width.

Build

Android / Bionic arm64

cmake -S . -B build/android-arm64 \
  -DANDROID_ABI=arm64-v8a \
  -DANDROID_PLATFORM=android-26 \
  -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
cmake --build build/android-arm64 -j

Linux / glibc x86_64

The glibc target omits the Android JNI and AHardwareBuffer entry points and uses the layer's single-device path with device-local Vulkan images. It still uses the same embedded shader graph and implicit-layer interception points.

On an x86_64 Linux system with a C++17 compiler, Vulkan headers/loader, CMake, and pthreads installed:

./build-linux-x86_64.sh

The output is staged at dist/linux-x86_64/:

libbionic_fg.so
VkLayer_BIONIC_framegen.json

Linux / glibc i386 compatibility

The i386 build lets 32-bit Proton/Wine and native Linux Vulkan applications use the same layer. It requires a 32-bit C++ toolchain and Vulkan development library; on Debian/Ubuntu these are g++-multilib and libvulkan-dev:i386.

dpkg --add-architecture i386
apt install build-essential cmake g++-multilib libvulkan-dev:i386
./build-linux-i386.sh

The output is staged at dist/linux-i386/:

libbionic_fg.so
VkLayer_BIONIC_framegen_i386.json

The manifest is intended for:

~/.local/lib/libbionic_fg.so
~/.local/share/vulkan/implicit_layer.d/VkLayer_BIONIC_framegen.json

On x86_64 Linux, install both the x86_64 and i386 artifacts above. The library_arch fields in the manifests prevent the loader from attempting to load a 64-bit library into a 32-bit process (or vice versa).

Enable the layer for a test process with BIONIC_FG_ENABLE=1 and point BIONIC_FG_CONFIG at a compatible conf.toml as described above.

License

GPL-3.0. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages