Skip to content

add PLATFORM_OFFSCREEN: EGL surfaceless backend for headless CI#23

Open
adeebshihadeh wants to merge 2 commits intomasterfrom
platform-offscreen
Open

add PLATFORM_OFFSCREEN: EGL surfaceless backend for headless CI#23
adeebshihadeh wants to merge 2 commits intomasterfrom
platform-offscreen

Conversation

@adeebshihadeh
Copy link

Summary

  • Adds PLATFORM_OFFSCREEN platform backend using EGL_MESA_platform_surfaceless
  • Creates an OpenGL context without any display server (no X11/Wayland/Xvfb needed)
  • Uses a 1x1 pbuffer surface so FBO 0 remains valid
  • Supports OpenGL 3.3 (desktop) and OpenGL ES 2/3 via build flags
  • All window/input functions are stubbed appropriately for headless use

Motivation

Allows openpilot CI to run UI tests and generate UI reports without Xvfb. Combined with Mesa's llvmpipe, this provides full software OpenGL rendering in containers with no GPU or display server.

Test plan

  • Build with make PLATFORM=PLATFORM_OFFSCREEN on Linux
  • Verify raylib examples render correctly to FBOs
  • Run openpilot UI tests without Xvfb

🤖 Generated with Claude Code

Adds a new platform backend that creates an OpenGL context via
EGL_MESA_platform_surfaceless, eliminating the need for X11/Xvfb
in CI environments. Uses Mesa's llvmpipe for software rendering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
adeebshihadeh added a commit to commaai/openpilot that referenced this pull request Feb 24, 2026
Replace Xvfb + GLFW with EGL surfaceless platform (PLATFORM_OFFSCREEN)
for CI rendering. This creates an OpenGL context directly via EGL without
needing any display server, using Mesa's llvmpipe for software rendering.

Changes:
- build.sh: build raylib with PLATFORM_OFFSCREEN when CI=1
- SConscript: link with EGL+GL in CI instead of just GL
- tests.yaml: replace `source setup_xvfb.sh` with LIBGL_ALWAYS_SOFTWARE=1,
  add raylib rebuild step before scons
- setup_dependencies.sh: remove xvfb, add libegl-dev and libgl-dev

Depends on: commaai/raylib#23

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GLAD (included via rlgl.h) embeds its own khrplatform.h that sets the
__khrplatform_h_ guard but renames KHRONOS_APIENTRY to
KHRONOS_GLAD_API_PTR. This prevents the system khrplatform.h from being
included when EGL headers need it, leaving EGLAPIENTRYP and EGLAPIENTRY
undefined, which breaks all EGL function declarations.

Also remove unnecessary -DEGL_NO_X11 from PLATFORM_OFFSCREEN CFLAGS
since modern Khronos eglplatform.h doesn't use it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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