-
Notifications
You must be signed in to change notification settings - Fork 126
feat(starry): add doom Wayland GL test + fix DRM stride-aware present #1415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
31048c9
feat(starry): add doomgeneric Wayland integration test
zyc107109102 cd83ee9
update
zyc107109102 eda572b
feat(starry): add doom Wayland GL test + fix DRM stride-aware present
zyc107109102 1e16f7a
update
zyc107109102 eeeeb16
update
zyc107109102 950efb7
test ci
zyc107109102 07c53bb
update
zyc107109102 5b96a9d
update
zyc107109102 7190e37
test ci
zyc107109102 f004b36
update
zyc107109102 2170f01
更新,从url下载代替上传压缩包
zyc107109102 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| # doomgeneric Wayland 集成测试 | ||
|
|
||
| 在 StarryOS 上运行 Weston (DRM backend + GL/llvmpipe 渲染器) 作为 Wayland | ||
| compositor,然后通过 doomgeneric (SDL2 Wayland 输出) 运行 Doom 游戏, | ||
| 验证从内核 DRM 到用户态渲染的全链路连通性。 | ||
|
|
||
| ## 当前状态 | ||
|
|
||
| | 组件 | 状态 | 备注 | | ||
| |---|---|---| | ||
| | Weston DRM + GL (llvmpipe) | ✅ 正常 | `--renderer=gl` 路径,214x120 分辨率 | | ||
| | doomgeneric + SDL Wayland | ✅ 正常 | SDL_RENDER_DRIVER=opengles2 + LIBGL_ALWAYS_SOFTWARE=1 | | ||
|
|
||
| ## 分辨率说明 | ||
|
|
||
| 测试使用 **214x120** 分辨率,与 ffplay 测试的 284x160 不同。 | ||
| 这是为了验证 DRM 驱动支持任意分辨率的模式设置。 | ||
|
|
||
| - QEMU 配置: `virtio-gpu-pci,xres=214,yres=120` | ||
| - Weston: 自动检测 DRM 分辨率 | ||
|
|
||
| ## 内核需求 | ||
|
|
||
| - `/dev/dri/card0` — DRM 设备(CREATE_DUMB、MAP_DUMB、ADDFB2、GETCAP)、 | ||
| PRIME dma-buf 导出/导入(HANDLE_TO_FD / FD_TO_HANDLE) | ||
| - `/dev/input/event*` — evdev 输入(鼠标、键盘) | ||
| - `memfd_create` + seal 支持 | ||
| - AF_UNIX SCM_RIGHTS 文件描述符传递 | ||
| - sysfs 设备枚举 | ||
|
|
||
| ## 测试流程 | ||
|
|
||
| 1. 启动 Weston(`kiosk-shell`,DRM 后端,GL/llvmpipe 渲染器) | ||
| 2. 等待 Wayland socket 就绪(最多 120 秒) | ||
| 3. 启动 doomgeneric(SDL_VIDEODRIVER=wayland,SDL_RENDER_DRIVER=opengles2,LIBGL_ALWAYS_SOFTWARE=1) | ||
| 4. 验证进程存活 35 秒 | ||
| 5. 输出 `DOOMGENERIC_TEST_PASSED` 或 `DOOMGENERIC_TEST_FAILED` | ||
|
|
||
| ## 构建说明 | ||
|
|
||
| doomgeneric 从源代码构建,首次构建时从 GitHub 下载: | ||
|
|
||
| - 源码地址:`https://github.com/ozkl/doomgeneric/archive/refs/heads/master.tar.gz` | ||
| - 缓存路径:`target/doomgeneric-source.tar.gz`(已加入 `.gitignore`) | ||
|
|
||
| ### 构建流程 | ||
|
|
||
| 1. 从 GitHub 下载源码(已缓存则跳过) | ||
| 2. 解压到临时目录,修改 `Makefile.sdl` 使用 `gcc` | ||
| 3. 使用 `qemu-user` 运行 Alpine GCC,编译 doomgeneric(链接 Alpine musl) | ||
| 4. 复制编译好的二进制文件到 rootfs overlay | ||
|
|
||
| ### 主机依赖 | ||
|
|
||
| 构建需要在主机上安装以下工具(Docker 镜像已预装): | ||
|
|
||
| - `debugfs` (e2fsprogs) — 操作 rootfs 镜像 | ||
| - `install` (coreutils) — 复制文件 | ||
| - `readelf` (binutils) — 解析动态库依赖 | ||
| - `qemu-user-static` — 运行 Alpine 工具链 | ||
|
|
||
| ### 依赖的 Alpine 包 | ||
|
|
||
| | 包 | 用途 | | ||
| |---|---| | ||
| | weston + weston-backend-drm | Wayland compositor + DRM 后端 | | ||
| | mesa + mesa-egl + mesa-gl + mesa-dri-gallium + mesa-gbm | Mesa GL 库和 DRI 驱动 | | ||
| | libinput + libxkbcommon + xkeyboard-config | 输入 + 键盘映射 | | ||
| | pixman | 软件渲染回退 | | ||
| | freedoom | Doom WAD 文件(开源版) | | ||
| | sdl2 + sdl2_mixer | SDL2 渲染库(Wayland 后端) | | ||
| | gcc + make + musl-dev + sdl2-dev + sdl2_mixer-dev | 编译工具链和头文件 | | ||
|
|
||
| ## 构建与运行 | ||
|
|
||
| ```bash | ||
| cargo xtask starry app qemu -t doom --arch x86_64 | ||
| ``` | ||
|
|
||
| 这会依次: | ||
| - 构建 StarryOS 内核(含 DRM display + PRIME dma-buf 支持) | ||
| - 运行 `prebuild.sh` 构建 rootfs overlay(安装 Alpine 包、编译 doomgeneric、复制运行时库、复制 Freedoom WAD) | ||
| - 启动 QEMU(virtio-gpu-pci,VNC :0,4 核 2G,214x120 分辨率,TCG 加速) | ||
| - 等待测试结果(QEMU 进程超时 180 秒) | ||
|
|
||
| ## 查看画面 | ||
|
|
||
| QEMU 使用 VNC 显示输出,需要通过 VNC 连接查看: | ||
|
|
||
| ```bash | ||
| vncviewer localhost:5900 | ||
| ``` | ||
|
|
||
| 或浏览器打开 `http://localhost:6080/vnc.html`(需 noVNC)。 | ||
|
|
||
| ## Docker 内运行 | ||
|
|
||
| ```bash | ||
| docker run --rm \ | ||
| -v $(pwd):/workspace \ | ||
| -w /workspace \ | ||
| --network host \ | ||
| ghcr.io/rcore-os/tgoskits-container:latest \ | ||
| cargo xtask starry app qemu -t doom --arch x86_64 | ||
| ``` | ||
|
|
||
| VNC 端口 `:0` 映射到宿主机 `localhost:5900`,`--network host` 确保 VNC | ||
| 连接可达。 | ||
|
|
||
| ## 与 ffplay 测试的区别 | ||
|
|
||
| | 项目 | ffplay | doomgeneric | | ||
| |---|---|---| | ||
| | 分辨率 | 284x160 | 214x120 | | ||
| | Weston 渲染器 | GL (llvmpipe) | GL (llvmpipe) | | ||
| | 测试内容 | 视频播放 | 游戏运行 | | ||
| | 输入支持 | 无 | 鼠标 + 键盘(virtio-tablet + virtio-keyboard) | | ||
|
|
||
| ## 故障排除 | ||
|
|
||
| ### 无 DRM 设备 | ||
| 确保 QEMU 配置包含 `virtio-gpu-pci` 设备。 | ||
|
|
||
| ### Weston 启动失败 | ||
| 检查 weston 日志:`/tmp/weston.log` 和 `/tmp/weston-stderr.log` | ||
|
|
||
| ### doomgeneric 无响应 | ||
| 检查 doomgeneric 日志:`/tmp/doomgeneric_stderr.log` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| target = "x86_64-unknown-none" | ||
| env = { AX_IP = "10.0.2.15", AX_GW = "10.0.2.2" } | ||
| log = "Warn" | ||
| features = [ | ||
| "ax-feat/display", | ||
| "axplat-dyn/efi", | ||
| "ax-driver/virtio-blk", | ||
| "ax-driver/virtio-net", | ||
| "ax-driver/virtio-input", | ||
| "ax-driver/virtio-gpu", | ||
| "ax-driver/virtio-socket", | ||
| "starry-kernel/input", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| export STARRY_APP_DIR=/workspace/apps/starry/doom | ||
| export STARRY_ARCH=x86_64 | ||
| export STARRY_ROOTFS=/tmp/.tgos-images/rootfs-x86_64-alpine.img/rootfs-x86_64-alpine.img | ||
| export STARRY_STAGING_ROOT=/workspace/tmp/doom-staging | ||
| export STARRY_OVERLAY_DIR=/workspace/tmp/doom-overlay | ||
| export STARRY_WORKSPACE=/workspace | ||
|
|
||
| rm -rf "$STARRY_STAGING_ROOT" "$STARRY_OVERLAY_DIR" | ||
| mkdir -p "$STARRY_STAGING_ROOT" "$STARRY_OVERLAY_DIR" | ||
|
|
||
| cd /workspace | ||
| bash /workspace/apps/starry/doom/prebuild.sh 2>&1 | ||
| echo "EXIT_CODE=$?" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不建议把
doomgeneric-master.tar.gz作为新增二进制归档直接入库。这个 3MB tarball 对 review 来说是 opaque blob,后续也难确认它对应哪个 upstream commit/tag。请改成 prebuild 按固定 tag/commit URL 下载并校验 sha256,或把需要维护的最小源码补丁以可审查的文本形式放在仓库里。这样 Doom app 的来源和构建结果才能像其它 Starry app 一样可复现。