Skip to content

Add Wayland-compatible AppStore runtime - #1

Open
vicliu624 wants to merge 1 commit into
CardputerZero:mainfrom
vicliu624:codex/wayland-compat
Open

vicliu624 wants to merge 1 commit into
CardputerZero:mainfrom
vicliu624:codex/wayland-compat

Conversation

@vicliu624

@vicliu624 vicliu624 commented May 23, 2026 •

Copy link
Copy Markdown

Summary

  • add a wrapper that selects Wayland/SDL or framebuffer runtime based on the current display environment
  • add Wayland build output alongside the existing framebuffer runtime
  • add Zero desktop metadata for Wayland task matching
  • keep the framebuffer path available for the legacy launcher
  • improve install/uninstall behavior in the Zero runtime without changing the AppStore UI contract

Validation

  • deployed and exercised on pi@192.168.50.35
  • verified the AppStore can run in the Zero labwc session without OS-specific window rules
  • verified package install/uninstall flow shows the system authorization prompt and updates APPLaunch desktop entries

@dianjixz

Copy link
Copy Markdown
Collaborator

The current implementation has changed since this PR was opened. Please rebase this PR on the latest target branch and adapt the changes to the current implementation, while preserving the intended Wayland support and compatibility with the existing runtime paths. Thank you.

@vicliu624
vicliu624 force-pushed the codex/wayland-compat branch 2 times, most recently from 103ddbc to c554f69 Compare August 13, 2026 10:07
@vicliu624
vicliu624 force-pushed the codex/wayland-compat branch from c554f69 to 63c411e Compare August 13, 2026 10:31
@vicliu624

Copy link
Copy Markdown
Author

The current implementation has changed since this PR was opened. Please rebase this PR on the latest target branch and adapt the changes to the current implementation, while preserving the intended Wayland support and compatibility with the existing runtime paths. Thank you.

Thanks for the review. I’ve rebased this PR on the current target branch and reworked it to fit the current runtime structure.

The main idea is that fbdev/evdev is still the default and primary runtime path for CardputerZero. A normal CardputerZero=y build, as well as the existing upstream setup.ini deployment flow, stays unchanged: it still builds and deploys the original single M5CardputerZero-AppStore executable and uses the existing fbdev/evdev configuration. The standard deployment does not need a Wayland launcher, extra environment variables, or additional runtime files.

Wayland support is now an explicit optional dual-runtime setup, rather than something that replaces fbdev. When this optional package is assembled, it contains:

  • M5CardputerZero-AppStore at the original path, acting as a small launcher;
  • M5CardputerZero-AppStore-fbdev for the existing fbdev runtime;
  • M5CardputerZero-AppStore-wayland for the optional Wayland runtime.

The launcher respects an explicitly set SDL_VIDEODRIVER first. If it is not set, it only chooses Wayland when WAYLAND_DISPLAY is available; otherwise it uses fbdev. So a normal CardputerZero environment continues to use the existing fbdev path, while a Wayland-capable environment can opt into the SDL/Wayland binary.

The launcher uses exec to start the selected native executable. Both runtime binaries remain in the same application directory, so the existing executable-relative resource and backend lookup logic continues to work as expected.

I also added checks for the launcher’s selection and fallback behavior, and confirmed that the default deployment manifest still only contains the original fbdev deployment.

One thing to note for transparency: I no longer have access to a CardputerZero device, as the one I had was returned, so I could not do final validation on the real hardware after this rebase. I did test the Wayland runtime and launcher-selection behavior on a Raspberry Pi running Wayland. The final hardware verification on CardputerZero will still need to be done by a maintainer or contributor with access to a device. Because of that, I kept the default fbdev deployment path aligned with the current upstream behavior and made Wayland strictly an optional, non-disruptive addition.

@dianjixz

Copy link
Copy Markdown
Collaborator

Thanks for the August update — sorry it took us a while to get back to this. I re-checked the branch against main today (2026-10-30) and it still can't be merged. The concrete blockers:

1. The branch is ~3 months behind main and conflicts.
Head 63c411e is based on 22d68d7 (2026-07-28); main is now e13d32c (2026-10-30), 32 commits ahead, including #5 and #6. GitHub reports the PR as unmergeable, and a local test merge conflicts in main/SConstruct. The conflict is on the staging line: 65f1225 replaced the (path, name) tuple with a plain path (STATIC_FILES += [STAGED_APPLAUNCH]). Please rebase and follow that form — STATIC_FILES += [RUNTIME_WRAPPER] is enough, because the wrapper's basename is already M5CardputerZero-AppStore.

2. The new launcher test fails on the PR head.
sh tests/test_runtime_launcher.sh exits 1. The DISPLAY=:0 case expects wayland|||, but bin/M5CardputerZero-AppStore exports SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR=0 / PREFER_LIBDECOR=0 unconditionally (lines 42–43) and prints wayland||0|0. Those overrides should only be exported when WAYLAND_DISPLAY is set — the DISPLAY-only case expects them unset, while the SDL_VIDEODRIVER=x11 case (which also sets WAYLAND_DISPLAY) expects them set. Since there is no CI in the repo, please run tests/run_tests.sh on the branch before pushing.

3. The SDL window setup looks like dead code.
The new configure_sdl_window() in main/ui/appstore.cpp (and the <SDL.h> / lv_sdl_window.h includes) is guarded by CONFIG_V9_5_LV_USE_SDL, but that file never includes global_config.h. The SDK provides Kconfig values through the generated build/config/global_config.h rather than -DCONFIG_* flags — that's why main/src/main.cpp, main/src/sdl_compat.cpp and main/ui/appstore_paths.cpp include it explicitly. As written, the window title / fixed 320×170 / borderless setup is silently compiled out, so the behaviour described in the README wouldn't actually happen. Please add the include (the __has_include guard used in appstore_paths.cpp is a good pattern), rebuild the SDL profile and re-verify on the labwc session; also please confirm the native Wayland build still compiles with the current sdk_version (the hardcoded /usr/include/SDL2 in main/SConstruct is fragile).

4. The deployment story still has a gap.
setup.ini installs only /home/pi/dist/M5CardputerZero-AppStore. After the documented CardputerZero=y APPSTORE_DISPLAY_BACKEND=fbdev scons, that file in dist/ is the wrapper while the real binary is M5CardputerZero-AppStore-fbdev — a stock setup.ini push would install a wrapper with no runtime and fail at startup (exit 127). Please extend the release/deploy step to install all three files (or document the manual step right next to the build command). Also tests/run_tests.sh assumes dist/M5CardputerZero-AppStore is the real backend binary; in the wayland/dual builds that path is now the wrapper.

5. Hardware validation is still outstanding.
You mentioned you no longer have a CardputerZero — understood, and thanks for being upfront. But this PR changes display startup and packaging, so we can't merge it without a run on real hardware. Please provide a short, reproducible checklist (build commands, expected dist/ layout, install + launch + install/uninstall on device) that someone with a device can execute, or point us to someone who can run it.

Smaller items:

  • Please add the SPDX copyright/license header to tests/test_runtime_launcher.sh and tests/test_runtime_deployment.sh; the rest of the tree has them since 01d1c18.
  • The PR description still says “add Zero desktop metadata for Wayland task matching”, but no .desktop file is in the diff — please update the description or add the file.
  • In auto mode, if WAYLAND_DISPLAY is set but the Wayland binary is missing, the wrapper exits 127; falling back to fbdev (or a clearer error message) would be safer.

The overall design — fbdev stays the default, Wayland is an explicit opt-in, the wrapper keeps the APPLaunch entry path — is the right direction, and I'd like to get it in. If you can rebase and address 1–4, I'll re-review quickly. If you don't have the bandwidth for another round, tell us and we'll decide whether to take over the packaging part or close it for now.

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.

2 participants