fix(vdd): fallback display modes after CCD failures#713
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
Walkthrough在 Windows 显示设备设置路径中为 VDD(ZAKO_NAME)场景添加专用应用策略:直接应用失败时先按延迟重试(250/500/1000ms),仍失败则生成并按序尝试回退候选(降频至120/60或固定1920x1080@60),首次成功即返回。 ChangesVDD 显示模式重试与回退流程
评估指标🎯 3 (Moderate) | ⏱️ ~20 minutes 可能关联的 Issue
可能关联的 PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)src/platform/windows/display_device/settings.cppIn file included from src/platform/windows/display_device/settings.cpp:10: ... [truncated 2200 characters] ... ion_log.(fun) in file "src/clang/cTrans.ml", line 4782, characters 12-47 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/platform/windows/display_device/settings.cpp`:
- Around line 220-255: The current implementation of with_display_mode and
make_vdd_fallback_modes abuses a single display_mode_t from requested_modes
(std::begin(requested_modes)->second) and then overwrites every entry in
device_display_mode_map_t with that one mode, which incorrectly forces all
devices to the same fallback; instead either (A) change make_vdd_fallback_modes
to produce a device-specific device_display_mode_map_t (i.e., build per-device
candidates from each entry in requested_modes) and stop using a single prototype
mode, or (B) if you intend to keep a single-mode path, assert early in
make_vdd_fallback_modes that all entries in requested_modes are identical (and
fail/return early otherwise) before calling with_display_mode; update callers
(e.g., any set_display_modes usage noted around the other affected block) to
handle per-device fallbacks accordingly. Ensure references: with_display_mode,
make_vdd_fallback_modes, device_display_mode_map_t, requested_modes,
set_display_modes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b80822e7-ccaf-4495-ae69-5cbf9efdfc7e
📒 Files selected for processing (1)
src/platform/windows/display_device/settings.cpp
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Windows
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.{cpp,c,h}
⚙️ CodeRabbit configuration file
src/**/*.{cpp,c,h}: Sunshine 核心 C++ 源码,自托管游戏串流服务器。审查要点:内存安全、 线程安全、RAII 资源管理、安全漏洞。注意预处理宏控制的平台相关代码。
Files:
src/platform/windows/display_device/settings.cpp
src/platform/**
⚙️ CodeRabbit configuration file
src/platform/**: 平台抽象层代码(Windows/Linux/macOS)。确保各平台实现一致, 注意 Windows API 调用的错误处理和资源释放。
Files:
src/platform/windows/display_device/settings.cpp
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/platform/windows/display_device/settings.cpp`:
- Around line 255-277: The current loops that generate fallback candidates skip
modes like 119.88Hz and 59.94Hz because they use strict >121.0 / >61.0 checks;
update the checks in the candidate generation loops (the loops iterating over
candidate_modes and using refresh_rate_hz(mode.refresh_rate)) to include rates
that are close to the integer targets—e.g. treat a mode as a 120Hz candidate
when refresh_rate_hz(...) >= 119.5 (or fabs(refresh_rate_hz(...) - 120.0) <=
0.5) and as a 60Hz candidate when refresh_rate_hz(...) >= 59.5 (or fabs(... -
60.0) <= 0.5), then set mode.refresh_rate = refresh_rate_t { 120, 1 } / { 60, 1
} and call add_candidate(candidate_modes) exactly as before (symbols:
candidate_modes, requested_modes, refresh_rate_hz, refresh_rate_t,
add_candidate).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ed95c6cf-3765-4544-94c5-10cba7e60d53
📒 Files selected for processing (1)
src/platform/windows/display_device/settings.cpp
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.{cpp,c,h}
⚙️ CodeRabbit configuration file
src/**/*.{cpp,c,h}: Sunshine 核心 C++ 源码,自托管游戏串流服务器。审查要点:内存安全、 线程安全、RAII 资源管理、安全漏洞。注意预处理宏控制的平台相关代码。
Files:
src/platform/windows/display_device/settings.cpp
src/platform/**
⚙️ CodeRabbit configuration file
src/platform/**: 平台抽象层代码(Windows/Linux/macOS)。确保各平台实现一致, 注意 Windows API 调用的错误处理和资源释放。
Files:
src/platform/windows/display_device/settings.cpp
🔇 Additional comments (1)
src/platform/windows/display_device/settings.cpp (1)
219-252: LGTM!Also applies to: 313-319
改了啥呀
set_display_modes()三段式逻辑;只有目标全是Zako HDR且失败时,才进入补强路径。120Hz、同分辨率60Hz,最后1920x1080@60。为啥要改
BlackCat 的日志显示 VDD 已经创建出来,但
2560x1600@144在SetDisplayConfig的 recommended / strict / explicit target 三种方式里都被 Windows 返回ERROR_GEN_FAILURE/1610拒绝。这类问题很可能是 VDD 刚创建后,Windows 还没稳定暴露目标 mode/source/target 组合,或者高分高刷组合本身不在当前可应用集合里。继续直接 503 会让用户感觉“VDD 创建失败”,但实际更像“目标显示模式还不能用”。
这次改成:先等一下再试,还不行就自动降级到更安全的 VDD 模式,尽量让串流能进;只有 fallback 全失败才保留原来的失败行为。
验证
git diff --checkcmake --preset dev-win -DPKG_CONFIG_EXECUTABLE=C:/Strawberry/perl/bin/pkg-config.bat未完成:当前本地工具链缺libcurl.pc,配置停在依赖发现阶段,还没进入本次 C++ 改动编译。CI 需要继续验证 Windows build。