diag(vkernel): 桌面线程每秒心跳,打印脏行/渲染/窗口/光标状态

现象:日志停在 “[desktop] thread started”,QEMU 卡死;屏幕只有上方一小块变蓝、
UEFI 文本未被覆盖 —— 指向渲染/刷新阶段的 _dirty_* 状态不正确(而非整屏写入卡住)。

在 desktop_thread 主循环的“每秒”分支打印:
  [dt] sec=… dc=… dymin=… dymax=… rc=… win=… cx=… cy=…
作用:
  - 若完全没有 [dt] 输出 → 线程在首轮之前就卡住(_mark_all_dirty 或循环顶部);
  - 若有输出且 sec 递增 → 线程在跑,问题在渲染/刷新(dc/dymax 数值即可解释
    “只刷顶部一小块”)。
定位后连同其它 [DIAG] 一并移除。
This commit is contained in:
TermiNexus committed 2026-10-14 14:08:56 +08:00
1 parent 3bb6a9a102
commit 164228e15a
1 file changed
+5
+5
View File
@@ -1703,6 +1703,11 @@ def desktop_thread(arg: rawptr) -> int:
_dt_cur_sec: uint32 = timer.timer_get_seconds()
if _dt_cur_sec != _dt_hb_sec:
_dt_hb_sec = _dt_cur_sec
# [DIAG] 每秒心跳:打印渲染/脏行/窗口/光标关键状态(定位“只刷顶部一小块+卡死”)
_dt_dbg: [144]char
viperlib.snprintf(&_dt_dbg, 144, "[dt] sec=%u dc=%d dymin=%d dymax=%d rc=%d win=%d cx=%d cy=%d\n",
_dt_cur_sec, _dirty_count, _dirty_y_min, _dirty_y_max, _render_count, _win_count, _cursor_x, _cursor_y)
serial.puts(&_dt_dbg)
cur_sec: uint32 = timer.timer_get_seconds()
if cur_sec != _last_clock_sec:
_last_clock_sec = cur_sec