Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .emb/base.emb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ cross:
BUILD_BACKEND_SOFTWARE: 'ON'
BUILD_BACKEND_WAYLAND_EGL: 'OFF'
BUILD_BACKEND_WAYLAND_VULKAN: 'OFF'
headless-egl:
BUILD_BACKEND_HEADLESS_EGL: 'ON'
headless-software:
BUILD_BACKEND_HEADLESS_SOFTWARE: 'ON'
BUILD_BACKEND_WAYLAND_EGL: 'OFF'
BUILD_BACKEND_WAYLAND_VULKAN: 'OFF'
2 changes: 1 addition & 1 deletion .emb/raspberry-pi.emb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ build:

cross:
defines:
BUILD_BACKEND_HEADLESS_EGL: 'OFF'
BUILD_BACKEND_HEADLESS_SOFTWARE: 'OFF'
DISABLE_PLUGINS: 'OFF'
PLUGINS_DIR: '../ivi-homescreen-plugins/plugins'

Expand Down
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,19 @@ endif ()
if (BUILD_BACKEND_SOFTWARE)
if (BUILD_BACKEND_DRM_KMS_EGL OR BUILD_BACKEND_DRM_KMS_VULKAN OR
BUILD_BACKEND_WAYLAND_EGL OR
BUILD_BACKEND_WAYLAND_VULKAN OR BUILD_BACKEND_HEADLESS_EGL)
BUILD_BACKEND_WAYLAND_VULKAN OR BUILD_BACKEND_HEADLESS_SOFTWARE)
message(FATAL_ERROR
"BUILD_BACKEND_SOFTWARE is mutually exclusive with the "
"DRM/Wayland/Headless EGL/Vulkan backends — pick exactly one")
"DRM/Wayland/Headless Software/Vulkan backends — pick exactly one")
endif ()
endif ()
if (BUILD_BACKEND_HEADLESS_SOFTWARE)
if (BUILD_BACKEND_DRM_KMS_EGL OR BUILD_BACKEND_DRM_KMS_VULKAN OR
BUILD_BACKEND_WAYLAND_EGL OR
BUILD_BACKEND_WAYLAND_VULKAN OR BUILD_BACKEND_SOFTWARE)
message(FATAL_ERROR
"BUILD_BACKEND_HEADLESS_SOFTWARE is mutually exclusive with the "
"DRM/Wayland/Software/Vulkan backends — pick exactly one")
endif ()
endif ()

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ All other parameters get assigned using the following ordering:

`BUILD_BACKEND_WAYLAND_VULKAN` - Build Backed for Vulkan. Defaults to OFF

`BUILD_BACKEND_HEADLESS_EGL` - Build Headless backend for EGL (OSMesa). Defaults to OFF
`BUILD_BACKEND_HEADLESS_SOFTWARE` - Build headless backend using the kSoftware CPU renderer (no EGL or GPU required). Defaults to OFF

`BUILD_COMPOSITOR` - Enable the `FlutterCompositor` backing-store API so platform-view layers can be interleaved with Flutter UI. See [Platform View Plugins](#platform-view-plugins). Defaults to OFF.

Expand Down
10 changes: 4 additions & 6 deletions cmake/config_common.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
#ifndef BUILD_BACKEND_DRM_KMS_VULKAN
#cmakedefine01 BUILD_BACKEND_DRM_KMS_VULKAN
#endif
#ifndef BUILD_BACKEND_HEADLESS_EGL
#cmakedefine01 BUILD_BACKEND_HEADLESS_EGL
#ifndef BUILD_BACKEND_HEADLESS_SOFTWARE
#cmakedefine01 BUILD_BACKEND_HEADLESS_SOFTWARE
#endif
#ifndef BUILD_BACKEND_SOFTWARE
#cmakedefine01 BUILD_BACKEND_SOFTWARE
Expand All @@ -58,8 +58,7 @@
// EGL is needed only by the EGL-based backends. Including <EGL/egl.h> here
// unconditionally dragged EGL/GL headers into the DRM-Vulkan and software
// builds, which must stay EGL/GL-free.
#if BUILD_BACKEND_WAYLAND_EGL || BUILD_BACKEND_DRM_KMS_EGL || \
BUILD_BACKEND_HEADLESS_EGL
#if BUILD_BACKEND_WAYLAND_EGL || BUILD_BACKEND_DRM_KMS_EGL
#define IVI_HAVE_EGL 1
#include <EGL/egl.h>
#else
Expand All @@ -73,8 +72,7 @@
// libwayland-cursor runtime deps. This condition MUST match the waypp build
// gate in third_party/CMakeLists.txt: waypp's own sources include this header
// (via logging.h), so a mismatch breaks waypp's build.
#if BUILD_BACKEND_WAYLAND_EGL || BUILD_BACKEND_WAYLAND_VULKAN || \
BUILD_BACKEND_HEADLESS_EGL
#if BUILD_BACKEND_WAYLAND_EGL || BUILD_BACKEND_WAYLAND_VULKAN
#include <waypp/waypp.h>
#endif

Expand Down
15 changes: 10 additions & 5 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,17 @@ if (USE_DRM_SCENE AND NOT (BUILD_BACKEND_DRM_KMS_EGL OR BUILD_BACKEND_DRM_KMS_VU
endif ()

#
# Headless
# Headless (software / CPU renderer — no GPU or Wayland)
#
option(BUILD_BACKEND_HEADLESS_EGL "Build Headless EGL Backend" OFF)
if (BUILD_BACKEND_HEADLESS_EGL)
find_package(PkgConfig)
pkg_check_modules(OSMESA osmesa glesv2 egl IMPORTED_TARGET REQUIRED)
option(BUILD_BACKEND_HEADLESS_SOFTWARE
"Build headless backend using kSoftware renderer — no GPU or Wayland required"
OFF)
if (BUILD_BACKEND_HEADLESS_SOFTWARE)
# Force all hardware sinks and libinput off: headless has no display
# device to scan out to and no /dev/input/event* to listen on.
set(BUILD_SOFTWARE_SINK_DRM OFF CACHE BOOL "" FORCE)
set(BUILD_SOFTWARE_SINK_FBDEV OFF CACHE BOOL "" FORCE)
set(BUILD_SOFTWARE_INPUT_LIBINPUT OFF CACHE BOOL "" FORCE)
endif ()

#
Expand Down
21 changes: 4 additions & 17 deletions docs/COMPOSITOR_GOLDENS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,9 @@ Both run against software rasterizers so they're CI-friendly.

## Prerequisites

### OSMesa (headless OpenGL)
### Headless software backend

Required for any EGL-side golden. The host's existing `BUILD_BACKEND_HEADLESS_EGL` already targets OSMesa.

Fedora:

```bash
sudo dnf install mesa-compat-libOSMesa mesa-compat-libOSMesa-devel
```

Ubuntu/Debian:

```bash
sudo apt install libosmesa6 libosmesa6-dev
```
`BUILD_BACKEND_HEADLESS_SOFTWARE` uses Flutter's `kSoftware` CPU renderer — no EGL or GPU required. No additional packages are needed beyond a standard build environment.

### lavapipe (headless Vulkan)

Expand Down Expand Up @@ -73,7 +61,7 @@ Configure with both flags on, point at the bundle:
```bash
cmake -S . -B build-goldens \
-DBUILD_UNIT_TESTS=ON \
-DBUILD_BACKEND_HEADLESS_EGL=ON \
-DBUILD_BACKEND_HEADLESS_SOFTWARE=ON \
-DBUILD_COMPOSITOR=ON \
-DUNIT_TEST_APP_BUNDLE=/path/to/flutter/build/linux/x64/release/bundle \
-DBUILD_NUMBER=1
Expand Down Expand Up @@ -114,11 +102,10 @@ VK_DRIVER_FILES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json \
homescreen -b "$BUNDLE" --window-type=BG
```

There is no native headless-Vulkan backend in this repo today (the existing `HeadlessBackend` is OSMesa/EGL only). Adding one would mean a fourth backend implementation along the lines of `WaylandVulkanBackend` but using `VK_EXT_headless_surface` + a memory-image swapchain — substantial, not on this branch. Until then, Vulkan goldens go through the weston-headless pairing above.
There is no native headless-Vulkan backend in this repo today (the existing `HeadlessBackend` is Software-only). Adding one would mean a fourth backend implementation along the lines of `WaylandVulkanBackend` but using `VK_EXT_headless_surface` + a memory-image swapchain — substantial, not on this branch. Until then, Vulkan goldens go through the weston-headless pairing above.

## What's deferred

- **HeadlessBackend compositor wiring.** `HeadlessBackend::GetCompositorConfig()` returns null callbacks today. `BUILD_COMPOSITOR=ON` with the headless backend currently falls back to direct rendering — i.e. the parity test verifies "compositor build doesn't break Flutter-only frames" but doesn't yet exercise the create/collect/present callbacks. Wiring requires either porting `GlCompositor` / `EglFboBackingStore` to desktop GL headers (OSMesa is desktop GL, not GLES) or templating those primitives over the GL header set.
- **Native headless Vulkan backend.** See above.
- **Multi-layer goldens.** Need a Dart bundle that emits a `PlatformViewLayer`; the renderer will then exercise `WaylandEglBackend::PresentLayers`'s general path and the new GL-texture composite step from the plugin migrations.

Expand Down
9 changes: 0 additions & 9 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,6 @@ key_event_handler.h
:private-members:
:undoc-members:

osmesa.h
--------

.. doxygenclass:: OSMesaHeadless
:project: ivi-homescreen
:members:
:private-members:
:undoc-members:

display.cc
----------

Expand Down
1 change: 0 additions & 1 deletion scripts/build_beagleplay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ phase4_build() {
-S "$REPO_DIR" -B "$BUILD_DIR"
-DCMAKE_TOOLCHAIN_FILE="$BUILD_DIR/.xc-toolchain.cmake"
-DCMAKE_BUILD_TYPE=Release
-DBUILD_BACKEND_HEADLESS_EGL=OFF
-DBUILD_BACKEND_DRM_KMS_VULKAN=OFF
)
case "$be" in
Expand Down
1 change: 0 additions & 1 deletion scripts/build_nitrogen8mm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ phase4_build() {
-DCMAKE_BUILD_TYPE=Release
-DBUILD_BACKEND_WAYLAND_EGL=OFF -DBUILD_BACKEND_WAYLAND_VULKAN=OFF
-DBUILD_BACKEND_DRM_KMS_EGL=ON -DBUILD_BACKEND_SOFTWARE=OFF
-DBUILD_BACKEND_HEADLESS_EGL=OFF
)
[[ "$WITH_SCENE" -eq 1 ]] && args+=(-DBUILD_COMPOSITOR=ON -DUSE_DRM_SCENE=ON)
if [[ "$NO_PLUGINS" -eq 1 ]]; then
Expand Down
1 change: 0 additions & 1 deletion scripts/build_radxa_zero3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,6 @@ phase4_build() {
-S "$REPO_DIR" -B "$BUILD_DIR"
-DCMAKE_TOOLCHAIN_FILE="$BUILD_DIR/.xc-toolchain.cmake"
-DCMAKE_BUILD_TYPE=Release
-DBUILD_BACKEND_HEADLESS_EGL=OFF
-DBUILD_BACKEND_DRM_KMS_VULKAN=OFF
)
case "$be" in
Expand Down
1 change: 0 additions & 1 deletion scripts/build_unoq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,6 @@ phase5_build() {
-S "$REPO_DIR" -B "$BUILD_DIR"
-DCMAKE_TOOLCHAIN_FILE="$BUILD_DIR/.xc-toolchain.cmake"
-DCMAKE_BUILD_TYPE=Release
-DBUILD_BACKEND_HEADLESS_EGL=OFF
)
case "$be" in
wayland-egl)
Expand Down
2 changes: 1 addition & 1 deletion scripts/clang_tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ echo "Using: $(command -v "${CLANG_TIDY}")"

# Only lint files actually compiled in this build configuration (those
# present in compile_commands.json). Files belonging to optional backends
# (osmesa, vulkan, dlt, ...) or plugin-only sources are skipped when the
# (software, vulkan, dlt, ...) or plugin-only sources are skipped when the
# corresponding feature is off, avoiding spurious errors from unavailable
# headers and mis-resolved compilation flags.
#
Expand Down
39 changes: 21 additions & 18 deletions shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ endif ()
# #if-gated on a Wayland backend. Skipping these for non-Wayland
# binaries drops the libwayland-client + libwayland-cursor link/runtime
# deps; drm-kms-egl and software builds become truly Wayland-free.
if (BUILD_BACKEND_WAYLAND_EGL OR BUILD_BACKEND_WAYLAND_VULKAN OR
BUILD_BACKEND_HEADLESS_EGL)
if (BUILD_BACKEND_WAYLAND_EGL OR BUILD_BACKEND_WAYLAND_VULKAN)
target_sources(${PROJECT_NAME} PRIVATE
wayland/display.cc
wayland/window.cc
Expand Down Expand Up @@ -83,22 +82,22 @@ if (BUILD_BACKEND_WAYLAND_EGL)
endif ()
endif ()

if (BUILD_BACKEND_HEADLESS_EGL)
target_sources(${PROJECT_NAME} PRIVATE
backend/headless/headless.cc
backend/headless/osmesa.cc
backend/gl_process_resolver.cc
)
endif ()

if (BUILD_BACKEND_SOFTWARE)
if (BUILD_BACKEND_HEADLESS_SOFTWARE OR BUILD_BACKEND_SOFTWARE)
target_sources(${PROJECT_NAME} PRIVATE
backend/software/file_sink.cc
backend/software/sink_factory.cc
backend/software/software_backend.cc
backend/software/software_cursor.cc
)
endif ()

if (BUILD_BACKEND_HEADLESS_SOFTWARE OR BUILD_BACKEND_SOFTWARE)
target_sources(${PROJECT_NAME} PRIVATE
display/software_display.cc
)
endif ()

if (BUILD_BACKEND_SOFTWARE)
if (BUILD_SOFTWARE_SINK_DRM)
target_sources(${PROJECT_NAME} PRIVATE
backend/software/drm_dumb_sink.cc
Expand All @@ -121,10 +120,10 @@ endif ()
# Shared libinput keyboard core (xkb translation + key-repeat) used by every
# libinput-backed seat — SoftwareSeat and (DRM) DrmSeat — so keyboard behavior
# is identical across backends. Depends only on libxkbcommon, which those seats
# already link. Added once here to avoid duplicate sources in multi-backend
# builds.
# already link. Also compiled for headless software so platform_homescreen's
# key event handler can resolve xkb symbols without the Wayland/waypp stack.
if (BUILD_SOFTWARE_INPUT_LIBINPUT OR BUILD_BACKEND_DRM_KMS_EGL OR
BUILD_BACKEND_DRM_KMS_VULKAN)
BUILD_BACKEND_DRM_KMS_VULKAN OR BUILD_BACKEND_HEADLESS_SOFTWARE)
target_sources(${PROJECT_NAME} PRIVATE
input/xkb_keyboard.cc
input/key_repeater.cc
Expand Down Expand Up @@ -316,9 +315,14 @@ endif ()
if (BUILD_BACKEND_WAYLAND_VULKAN)
target_link_libraries(${PROJECT_NAME} PRIVATE vulkan_headers)
endif ()
if (BUILD_BACKEND_HEADLESS_EGL)
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::OSMESA)
if (BUILD_BACKEND_HEADLESS_SOFTWARE)
# xkb_keyboard.cc (compiled above) calls libxkbcommon directly; link it
# explicitly since neither waypp nor SW_LIBINPUT bring it in for this path.
find_package(PkgConfig REQUIRED)
pkg_check_modules(HEADLESS_XKBCOMMON xkbcommon IMPORTED_TARGET REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::HEADLESS_XKBCOMMON)
endif ()

if (BUILD_CRASH_HANDLER)
target_link_libraries(${PROJECT_NAME} PRIVATE sentry::sentry)
endif ()
Expand All @@ -341,8 +345,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
# the wayland-gen protocol-header include dirs and the static library are both
# needed only there. Non-Wayland binaries (DRM EGL/Vulkan, software) get
# neither the headers nor the libwayland-client / libwayland-cursor deps.
if (BUILD_BACKEND_WAYLAND_EGL OR BUILD_BACKEND_WAYLAND_VULKAN OR
BUILD_BACKEND_HEADLESS_EGL)
if (BUILD_BACKEND_WAYLAND_EGL OR BUILD_BACKEND_WAYLAND_VULKAN)
target_include_directories(${PROJECT_NAME} PRIVATE
$<TARGET_PROPERTY:wayland-gen,INTERFACE_INCLUDE_DIRECTORIES>
)
Expand Down
Loading
Loading