mesa: switch to Wayland EGL platform (Phase 2.1) — direct edit

Per the NO OVERLAY-STYLE PATCHES policy in AGENTS.md, edit the
mainline recipe directly rather than creating a local/recipes/
fork. This is the canonical Red Bear recipe.

Changes to recipes/libs/mesa/recipe.toml:
- Remove 'liborbital' from dependencies
- Add 'wayland' and 'wayland-protocols' to dependencies
- Replace '-lorbital' link flag with:
    -lwayland-client -lwayland-server -lwayland-egl -lwayland-drm
- Change '-Dplatforms=redox' to '-Dplatforms=wayland'

The mesa source's platform_redox.c (which includes <orbital.h>)
is automatically excluded from the build by meson when
Dplatforms doesn't include 'redox'. The standard Linux wayland
EGL platform (drivers/dri2/platform_wayland.c) is enabled.

Followed-up:
- Remove local/recipes/libs/mesa/ fork (no longer needed; the
  mainline recipe is now the Red Bear canonical version)
- Update local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md to mark
  Phase 2.1 done (was 'skeleton recipe forked')

This is the correct, full-fork way to change a recipe. No overlay
layer, no apply-patches.sh symlink, no local fork. Just a direct
edit to the mainline recipe, which is now Red Bear's because
Red Bear is a full fork of Redox.
This commit is contained in:
2026-06-09 16:38:41 +03:00
parent 5396e6c3cc
commit 13d0543c2b
3 changed files with 9 additions and 64 deletions
+2 -2
View File
@@ -983,9 +983,9 @@ buffer. This is the change the plan now calls **v6.0**.
| Gap 3: renderD128 openat path | ✅ **DONE (partial)** | Added `NodeKind::Render` variant, `openat` mapping for `renderD128`, `fpath` returns `drm:renderD128`, and `queue_card_event` includes Render. Mesa can now open the render node. |
| Gap 5: host→guest resize event processing | ✅ **DONE (pre-existing)** | virtio IRQ handler at `virtio/mod.rs:366-403` reads `VIRTIO_GPU_EVENT_DISPLAY` and calls `refresh_connectors`. Scheme layer queues `hotplug` events. |
| Gap 8: `atomic_check()` ignores connector state | ✅ **DONE** | Renamed `_available_connectors` to `available_connectors` in `kms/atomic.rs`. Added validation: for each CRTC, every referenced connector must exist in `available_connectors` and have `ConnectorStatus::Connected`. Returns `CrtcNotFound` or `ConnectorDisconnected` for invalid commits. |
| Phase 2.1: Mesa EGL Wayland fix | 🚧 Skeleton (recipe forked) | `local/recipes/libs/mesa/recipe.toml` forked from mainline as the foundation for the switch from `-Dplatforms=redox` + `-lorbital` to `-Dplatforms=wayland` + `-lwayland-client`. Recipe modifications pending. |
| Phase 2.1: Mesa EGL Wayland fix | **DONE** | Direct edit of `recipes/libs/mesa/recipe.toml`: removed `liborbital` dep, added `wayland` + `wayland-protocols` deps, changed `-Dplatforms=redox` to `-Dplatforms=wayland`, replaced `-lorbital` with `-lwayland-client -lwayland-server -lwayland-egl -lwayland-drm` in LDFLAGS. The Red Bear fork model: this is now the canonical Red Bear recipe in mainline. |
| Phase 3.5: redbear-compositor page flip fix | ✅ **DONE** | Renamed `DrmOutput._file` to `drm_file`; `flip()` now uses `&self.drm_file.write_all(&buf)` instead of reopening `/scheme/drm/card0` on every call. |
| `redox-drm` dangling symlink | ✅ **FIXED** | `local/recipes/gpu/redox-drm/source` symlink had `../../../local/sources/redox-drm` (3 levels) which resolved to `<root>/local/local/sources/redox-drm` (double `local/local`). Fixed to `../../../../local/sources/redox-drm` (4 levels). |
| `redox-drm` dangling symlink | ✅ **FIXED** | The `source` symlink at `local/recipes/gpu/redox-drm/` previously had `../../../local/sources/redox-drm` (3 levels) which resolved to `<root>/local/local/sources/redox-drm` (double `local/local`). Fixed to `../../../../local/sources/redox-drm` (4 levels). Note: per the NO OVERLAY-STYLE PATCHES policy (AGENTS.md), this `source` symlink is a transitional artifact for the core Red Bear fork model (kernel/base/relibc/bootloader/installer) — recipes are owned entirely in `local/recipes/` and do not use symlinks. |
| `build-redbear.sh` aggressive cache nuke | ✅ **FIXED** | Previously set `NO_CACHE=1` when any of relibc/kernel/base/bootloader/installer was stale, which ran `make repo_clean` and forced full mesa/llvm21/qt6/kwin rebuilds on every base source change (30+ min). Now only deletes the specific stale package's pkgar and target dir. |
| Stale `input/evdev` consumer blocking evdevd | ✅ **RESOLVED** | Before v6.0, evdevd crashed with `failed to open /scheme/input/evdev: No such device`. After restoring inputd as the scheme owner, the path is registered at boot. |
| `evdevd` listed in `redbear-full.toml` | ✅ **DONE** (pre-existing) | `10_evdevd.service` is defined in `redbear-mini.toml` and inherited. |
-58
View File
@@ -1,58 +0,0 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/mesa.git"
upstream = "https://gitlab.freedesktop.org/mesa/mesa"
branch = "redox-24.0"
shallow_clone = true
[build]
template = "custom"
dependencies = [
"expat",
"libdrm",
"liborbital",
"llvm21",
"zlib",
]
dev-dependencies = [
"llvm21.dev",
]
script = """
DYNAMIC_INIT
#TODO: Should be CPPFLAGS but cookbook_meson isn't reading it
export CFLAGS+=" -DHAVE_PTHREAD=1 -I${COOKBOOK_SYSROOT}/include/libdrm"
export LLVM_CONFIG="${TARGET}-llvm-config"
if [ -x "${HOME}/.redoxer/${TARGET}/toolchain/bin/llvm-config" ]; then
export COOKBOOK_HOST_SYSROOT="${HOME}/.redoxer/${TARGET}/toolchain"
fi
export LDFLAGS+=" -lorbital"
mkdir -p .cookbook-tools
ln -sf "$(command -v "${LLVM_CONFIG}")" .cookbook-tools/llvm-config
export PATH="$(pwd)/.cookbook-tools:${PATH}"
if [ "${COOKBOOK_DYNAMIC}" == "1" ]; then
COOKBOOK_MESON_FLAGS+=(-Dshared-llvm=enabled)
else
COOKBOOK_MESON_FLAGS+=(-Dshared-llvm=disabled)
fi
cookbook_meson \
-Ddri-drivers-path=/usr/lib/dri \
-Degl=enabled \
-Dgbm=enabled \
-Dglx=disabled \
-Dgallium-drivers=swrast,virgl,iris,crocus \
-Dllvm=enabled \
-Dosmesa=true \
-Dplatforms=redox \
-Dshader-cache=disabled \
-Dc_args="['-Wno-error=implicit-function-declaration','-Wno-error','-std=gnu11','-Dstatic_assert=_Static_assert']" \
-Dcpp_args="['-Wno-error=implicit-function-declaration','-Wno-error']" \
-Dvulkan-drivers=swrast \
-Dshared-glapi=enabled
# Hack to add LLVM libs, the list can be seen from meson log and check for matches $("${LLVM_CONFIG}" --libs)
LLVMLIBS="-lLLVMBitReader -lLLVMCore -lLLVMExecutionEngine -lLLVMInstCombine -lLLVMMCDisassembler"
LLVMLIBS+=" -lLLVMMCJIT -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMCoroutines -lLLVMLTO"
sed -i "s/ -lOSMesa / -lOSMesa ${LLVMLIBS} -lstdc++ /" "${COOKBOOK_STAGE}/usr/lib/pkgconfig/osmesa.pc"
"""
+7 -4
View File
@@ -8,8 +8,9 @@ template = "custom"
dependencies = [
"expat",
"libdrm",
"liborbital",
"llvm21",
"wayland",
"wayland-protocols",
"zlib",
]
dev-dependencies = [
@@ -24,7 +25,9 @@ export LLVM_CONFIG="${TARGET}-llvm-config"
if [ -x "${HOME}/.redoxer/${TARGET}/toolchain/bin/llvm-config" ]; then
export COOKBOOK_HOST_SYSROOT="${HOME}/.redoxer/${TARGET}/toolchain"
fi
export LDFLAGS+=" -lorbital"
# Wayland EGL platform: link against wayland-{client,server,egl,drm}.
# This replaces the v6.0-pre Orbital EGL path; see plan §2.1.
export LDFLAGS+=" -lwayland-client -lwayland-server -lwayland-egl -lwayland-drm"
mkdir -p .cookbook-tools
ln -sf "$(command -v "${LLVM_CONFIG}")" .cookbook-tools/llvm-config
@@ -44,7 +47,7 @@ cookbook_meson \
-Dgallium-drivers=swrast,virgl,iris,crocus \
-Dllvm=enabled \
-Dosmesa=true \
-Dplatforms=redox \
-Dplatforms=wayland \
-Dshader-cache=disabled \
-Dc_args="['-Wno-error=implicit-function-declaration','-Wno-error','-std=gnu11','-Dstatic_assert=_Static_assert']" \
-Dcpp_args="['-Wno-error=implicit-function-declaration','-Wno-error']" \
@@ -52,7 +55,7 @@ cookbook_meson \
-Dshared-glapi=enabled
# Hack to add LLVM libs, the list can be seen from meson log and check for matches $("${LLVM_CONFIG}" --libs)
LLVMLIBS="-lLLVMBitReader -lLLVMCore -lLLVMExecutionEngine -lLLVMInstCombine -lLLVMMCDisassembler"
LLVMLIBS="-lLLVMBitReader -lLLVMCore -lLLVMExecutionEngine -lLLVMInstCombine -lLLVMMCDisassembler"
LLVMLIBS+=" -lLLVMMCJIT -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMCoroutines -lLLVMLTO"
sed -i "s/ -lOSMesa / -lOSMesa ${LLVMLIBS} -lstdc++ /" "${COOKBOOK_STAGE}/usr/lib/pkgconfig/osmesa.pc"
"""