优化:完成麒麟合成器与Ubuntu低延迟验证

This commit is contained in:
songyiming committed 2026-11-06 18:03:57 +08:00
1 parent 249e8f8537
commit b979b12286
46 files changed
+2913 -1

No files matched your search

+1
View File
@@ -11,6 +11,7 @@
- `0003-vdi-input-priority.patch` 在 Qt 根目录应用。可选地让帧就绪后的连续输入先执行,最多 32 条或 2ms,不能跨窗口/焦点/其他事件。`VDI_INPUT_PRIORITY=1` 才启用,默认关闭。另提供 `VDI_INPUT_TIMING=1` 的汇总统计,区分 SDL 输入派发年龄与主线程呈现调用耗时,不代表端到端延迟。
- `0004-vdi-power-key-policy.patch` 在 Moonlight Qt 根目录应用。客户端丢弃电源/睡眠键,以及 `Ctrl+Alt+Delete`、`Alt+F4`、`Win+L`、`Win+X`,防止云桌面被关机、重启、锁定或打开包含电源操作的系统菜单;按键不会发送到 Windows、Ubuntu 或麒麟客体系统。
- `0005-vdi-native-linux-cursor.patch` 在 Qt 根目录应用,为已配置的单座席Linux/X11/2K/绝对鼠标会话创建原生SDL光标,形状/热点/显隐经认证SSH同步,位置不等待视频帧;主机以精确SHA固定的捕获适配器在新连接前去除视频光标。状态过期等故障结束整次会话,恢复原服务后重连。Windows无对应profile,继续原逻辑。安装和限制见[模块说明](../native-cursor/README.md)。
- `0006-vdi-release-stuck-mouse-buttons.patch` 在焦点丢失和会话退出时显式释放五个远程鼠标按钮,避免一次中断丢失 `BUTTONUP` 后把 Ubuntu 留在“按住拖拽/点击”状态。
2026-11-03 的现场 RKMPP/EGL 使用独立 PacerRender 线程,诊断会话主线程 render 调用数为 0;因此第三补丁的新调度没有已证明的现场收益,未启用。当时默认客户端恢复至 SHA256 `35de7b1a4ade583823b23b5f2e012307f6d0a3848c8eb97bd6d4de9660afa00f`,该版本现保留作备份。2026-11-05加入0005后现场SHA为 `5d4330f703d7f8e053bc3795ca42bdaf231c9e9dd8ebb00a612013adbcccee03`,Linux profile在获取远端租约前严格校验此SHA;独立光标回归见[实施记录](../../docs/linux-native-cursor-20261105.md)。现场构建保留已有修改并加入0005,尚未重建部署其他任务的0004;构建器0001~0005清洁应用通过与现场补丁集合应分开判断。
@@ -0,0 +1,82 @@
--- a/app/streaming/input/input.h
+++ b/app/streaming/input/input.h
@@ -139,10 +139,14 @@
void handleTouchFingerEvent(SDL_TouchFingerEvent* event);
int getAttachedGamepadMask();
void raiseAllKeys();
+
+ // Release any remote mouse buttons when focus/session teardown interrupts
+ // the normal SDL button-up sequence.
+ void raiseAllMouseButtons();
void notifyMouseLeave();
void notifyFocusLost();
--- a/app/streaming/input/input.cpp
+++ b/app/streaming/input/input.cpp
@@ -278,13 +278,15 @@
// (desktop and exclusive), so we must check for that before releasing mouse capture.
if (!(SDL_GetWindowFlags(m_Window) & SDL_WINDOW_FULLSCREEN) && !m_AbsoluteMouseMode) {
setCaptureActive(false);
}
- // Raise all keys that are currently pressed. If we don't do this, certain keys
- // used in shortcuts that cause focus loss (such as Alt+Tab) may get stuck down.
+ // Raise all keys and mouse buttons that are currently pressed. If we don't
+ // do this, shortcuts or focus loss can leave the remote desktop in a stuck
+ // drag/click state.
raiseAllKeys();
+ raiseAllMouseButtons();
}
void SdlInputHandler::notifyFocusGained()
{
}
--- a/app/streaming/input/mouse.cpp
+++ b/app/streaming/input/mouse.cpp
@@ -25,10 +25,23 @@
}
}
}
}
+void SdlInputHandler::raiseAllMouseButtons()
+{
+ // A disconnect, focus loss, or a queued SDL event can skip BUTTONUP.
+ // Sending idempotent releases for every supported mouse button clears the
+ // host-side state and prevents the next session from inheriting a stuck
+ // drag/click.
+ static const int buttons[] = {BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT,
+ BUTTON_X1, BUTTON_X2};
+ for (int button : buttons) {
+ LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, button);
+ }
+}
+
void SdlInputHandler::handleMouseButtonEvent(SDL_MouseButtonEvent* event)
{
int button;
if (event->which == SDL_TOUCH_MOUSEID) {
--- a/app/streaming/session.cpp
+++ b/app/streaming/session.cpp
@@ -2338,12 +2338,15 @@
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "0");
if (QGuiApplication::platformName() == "eglfs") {
QGuiApplication::restoreOverrideCursor();
}
- // Raise any keys that are still down
+ // Raise any keys or mouse buttons that are still down. A stream can end
+ // without SDL delivering the matching BUTTONUP, so clear the remote state
+ // before destroying the handler and opening the next session.
m_InputHandler->raiseAllKeys();
+ m_InputHandler->raiseAllMouseButtons();
// Destroy the input handler now. This must be destroyed
// before allowwing the UI to continue execution or it could
// interfere with SDLGamepadKeyNavigation.
delete m_InputHandler;