Skip to content

fix: 延迟程序启动后立即检查显示器列表#506

Draft
Yundi339 wants to merge 1 commit intomasterfrom
feat_optvdd
Draft

fix: 延迟程序启动后立即检查显示器列表#506
Yundi339 wants to merge 1 commit intomasterfrom
feat_optvdd

Conversation

@Yundi339
Copy link
Copy Markdown
Collaborator

CCD全称是Connecting and Configuring Displays,是Windows用来记录显示器分辨率、刷新率和多屏布局的一套机制。所谓的“CCD锁”通常是指系统把显示器配置死死记在了注册表里,导致你换设备串流或者用虚拟屏时,分辨率死活对不上或者画面错位。搞串流的经常得去注册表里把那几个CCD相关的项删了重置,才能解决这些奇葩显示问题

win启动后初始化显示器,sunshine同时获取显示器列表,二者互相冲突,导致个别电脑,开机黑屏一段时间。说不定也可能是显示器的问题。
疑难杂症

Copilot AI review requested due to automatic review settings February 22, 2026 10:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在避免 Windows 启动阶段显示子系统初始化与 Sunshine 同时枚举/恢复显示配置发生互相阻塞,从而缓解部分机器“开机黑屏一段时间”的疑难问题。

Changes:

  • session_t::init() 中的显示设置恢复从“立即执行”改为“通过定时器延迟执行”。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +153 to +161
// 延迟恢复显示设置,避免在系统启动期间与显示子系统初始化互相阻塞
auto &session = session_t::get();
{
std::lock_guard lock { session.mutex };
session.timer->setup_timer([&session]() {
BOOST_LOG(info) << "尝试恢复显示设置...";
session.restore_state_impl();
return true; // 单次执行
});
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里复用 session_t 的 StateRetryTimer 做启动延迟恢复会被后续的 timer->setup_timer(...) 覆盖/取消(例如 configure_display 在成功路径会调用 timer->setup_timer(nullptr)),导致启动时的 crash recovery 可能根本不执行。更严重的是:如果旧的 persistent file 还没被 restore/revert 清理掉,就先进入 apply_config,有可能覆盖掉旧持久化数据,从而丢失“原始显示拓扑”信息。建议把“启动恢复”从共享 retry timer 中解耦(独立的一次性延迟任务/线程,或在第一次 configure_display 前强制完成一次恢复/至少加载并清理旧持久化文件),以保证恢复逻辑必定发生且不会与后续重试定时器互相踩踏。

Copilot uses AI. Check for mistakes.
@Yundi339 Yundi339 marked this pull request as draft February 22, 2026 10:45
@Yundi339
Copy link
Copy Markdown
Collaborator Author

复用 StateRetryTimer 有三个致命问题:
configure_display 成功后调用 timer->setup_timer(nullptr) 取消恢复
apply_config 在旧持久化文件未清理前运行,覆盖原始拓扑
Timer 语义混乱(启动恢复 vs 重试配置)

改造复杂度过高,建议是模仿上游,直接重构屏幕组合模块

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