Skip to content

feat: optional host GPU via GPU_MODE=host - #54

Open
s1oz wants to merge 2 commits into
Shmayro:mainfrom
s1oz:feat/host-gpu
Open

s1oz wants to merge 2 commits into
Shmayro:mainfrom
s1oz:feat/host-gpu

Conversation

@s1oz

@s1oz s1oz commented Sep 21, 2026

Copy link
Copy Markdown

Add an opt-in host GPU path for headless Intel/AMD/NVIDIA boxes. The emulator still defaults to SwiftShader. With GPU_MODE=host and /dev/dri passed through, gfxstream uses Mesa via a small headless modesetting Xorg (GLX) plus an EGL GBM hook, so guest GLES can run on the iGPU without a monitor. Viewing stays on scrcpy / scrcpy-web (-no-window).

No existing compose defaults are changed (port 5555, scrcpy-web, DNS, root/gapps remain as upstream).

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update

How Has This Been Tested?

On an Unraid host with Intel UHD 630, GPU_MODE=host, /dev/dri passed through:

  • Container glxinfo: Mesa Intel(R) UHD Graphics 630 (CFL GT2), accelerated
  • Emulator log: Graphics Adapter Android Emulator OpenGL ES Translator (Mesa Intel(R) UHD Graphics 630 (CFL GT2))
  • Guest: adb shell dumpsys SurfaceFlinger | grep GLES → same Mesa Intel string, OpenGL ES 3.0
  • ARM64 Unity APK ran via ndk_translation
  • Unset GPU_MODE still maps to swiftshader_indirect

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works (no unit-test harness; verified on a real iGPU)
  • New and existing unit tests pass locally with my changes (N/A)

Keep the default SwiftShader path. When GPU_MODE=host and /dev/dri is
passed through, start a headless modesetting Xorg for Mesa GLX and load
an EGL GBM hook so gfxstream can use the host GPU without a monitor.
--no-install-recommends gcc does not pull libc6-dev, so compiling the
hook in the runtime layer fails. Build the .so in a tiny stage and keep
Mesa/Xorg install noninteractive without purging gcc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant