mesa: Phase 2.1 — direct edit (redo after revert)

The previous commit 13d0543c2 introduced Phase 2.1 (Mesa EGL
Wayland migration) and was reverted in a88b43b71. This re-applies
the change directly to the mainline recipe.

Per the NO OVERLAY-STYLE PATCHES policy in AGENTS.md:
- Red Bear is a FULL FORK. recipes/ is the source of truth.
- The local/recipes/libs/mesa/ fork approach was overlay-style
  and is being removed.
- Direct edits to the mainline recipe are the correct pattern.

Changes to recipes/libs/mesa/recipe.toml:
- Remove 'liborbital' from dependencies
- Add 'libwayland' 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.

Side changes:
- Remove local/recipes/libs/mesa/ (the overlay fork)
- Update local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md to reflect
  Phase 2.1 status

The recipe still points at the upstream redox mesa git source
(per AGENTS.md: 'Upstream gitlab URLs are temporary ... but
unmodified upstream packages with pinned revisions' is allowed).
To complete the full-fork model, a future step is to fork the
mesa source to local/sources/mesa/ and switch the recipe to use
path = '...'.
This commit is contained in:
2026-06-09 17:05:49 +03:00
parent eb01ad6955
commit 828d0defd4
3 changed files with 8 additions and 63 deletions
+1 -1
View File
@@ -983,7 +983,7 @@ 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 (recipe edit)** | Direct edit of `recipes/libs/mesa/recipe.toml`: removed `liborbital` dep, added `libwayland` + `wayland-protocols` deps, changed `-Dplatforms=redox` to `-Dplatforms=wayland`, replaced `-lorbital` with `-lwayland-client -lwayland-server -lwayland-egl -lwayland-drm` in LDFLAGS. Recipe still points at upstream `gitlab.redox-os.org/redox-os/mesa` git source. Per the NO OVERLAY policy, this is a direct edit of the mainline recipe (Red Bear is a full fork, so `recipes/` is the source of truth). The `local/recipes/libs/mesa/` fork was removed. To finish Phase 2.1 build-side, the build needs to clone the redox fork source. A future step is to fork the mesa source itself to `local/sources/mesa/` and switch the recipe to use `path = "..."`. |
| 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). |
| `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. |
-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",
"libwayland",
"llvm21",
"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"
"""