Files
GVFG_Standalone/samples/gvfg_qt_preview/DELIVERY_DIAGNOSTICS.md
T
Mark.lin 29b449fc6e Optimize GVFG GPU preview and clarify delivery diagnostics
- Render preview directly from the FP16 conversion target into the selected
  8-bit or 10-bit swapchain, removing the full-frame scene copy and the
  intermediate BGRA8 preview pass without capture-frame decimation.
- Simplify neutral YUY2/Y210 shaders to one packed texture load per pixel;
  preserve BT.709 conversion, 10-bit unpacking and odd-width chroma handling.
- Cache shader resource views per upload slot and update constant-buffer
  contents only when source dimensions change.
- Allocate only preview resources and skip export-only shader compilation
  for preview; retain the full BGRA8/RGB10A2/NV12 buffer conversion path.
- Unbind render targets before swapchain resize/release and serialize preview
  configuration and resource changes with GPU rendering.
- Bound startup Present retries and retry presentation without redrawing;
  retain actual skipped-frame counts when presentation remains busy.
- Add preview delivery counters for presented, replaced, busy, failed,
  cancelled and pending frames, including busy source and affected frame ID.
- Fix an uncounted pending-frame replacement and drain pending preview work
  at Stop and before a new run to keep per-run accounting separate.
- Track application audio delivery, dropped duration, read/write stalls and
  frame-ID anomalies while retaining the original 10-block audio queue.
- Stop the channel on audio write failure or two seconds of zero-write
  progress; distinguish cancelled data from runtime drops.
- Keep the existing compact UI; aggregate delivery issue logs at most once
  per five seconds and emit a stop summary with accounting errors only.
- Document diagnostic interpretation, GPU changes and validation boundaries.

Validation:
- User testing reported approximately 15% lower GPU utilization after the
  optimization. Baseline/final readings and relative versus percentage-point
  interpretation were not supplied; no independent benchmark was performed.
- Static source checks and git diff --check passed. No application or shader
  build was performed by the agent; 10-bit startup resolution and long-run
  zero-loss behavior have not been confirmed.
- Rebuild the preview DLL with its matching APP; the SDK GPU buffer converter
  also shares the modified shader source. Capture APIs and driver are unchanged.
2026-09-04 16:02:33 +08:00

25 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 關鍵交付 Log
畫面保留原本狀態,不顯示完整交付統計,也不增加設定控制。正常運行不定期列印診斷快照。
- `Video issue`:預覽累計丟棄與原因。`replaced` 是舊影像被替換,`busy` 是無空槽/DXGI 忙碌跳過,`failed` 是提交或渲染失敗。
- busy 發生時附上 `present`/`slots` 分類累計數與 `last_frame_id`,可確認忙碌來源。
- `Audio issue`:累計丟棄區塊/毫秒數、最長寫入停滯、最長收音間隔,以及最近丟棄 ID/時間。
- 序號缺口、倒退/重複、音訊失敗位元組僅在有異常時附上。
- 異常最多每 5 秒彙整一次;累計數不漏計,最近 ID 不代表列出每個遺失區塊。Stop 會補記尚未輸出的異常。
- Stop 留一行 `Summary`。資料去向核對正常時不另外印訊息,只有不一致才印 `ERROR delivery accounting mismatch`。正常停止清掉的待處理資料不算運行丟失。
## 拿到 Log 後怎麼處理
Video 若以 replaced/busy 為主,查預覽/GPU 負載;failed 則查提交和渲染錯誤。APP 持續讀取並釋放每張影像,沒有新增預覽降頻行為。
啟動/重新 attach 預覽後,第一次呈現若 DXGI 回報忙碌,預覽執行緒會保留同一張已上傳的影像,每次等待 2 ms 再試,最多 8 次,且到達 16 ms 重試期限後不再發起重試(排程或呼叫本身可能使實際時間超過期限)。只有最終仍忙碌才計一次 preview drop;成功不算丟棄。平常呈現不重試,不清掉既有計數。等待不持有 SDK frame,但仍可能讓後續預覽影像被替換,替換照常計數。
Audio 保留原本最多 10 個 PCM 區塊的播放佇列(`kMaxQueuedAudioFrames`);滿時丟掉最舊區塊,再加入新區塊。毫秒數只用來表示實際丟失的音訊長度,不控制容量。若偶發丟棄,先根據 Log 的寫入停滯/收音間隔查原因,再決定是否需要調整;最長收音間隔包含正常區塊間隔,不能直接當成丟失時間。
播放 write 失敗,或持續回傳 0、兩秒沒有進展,會記錄原因並停止通道;檢查音效裝置後重新 Start。此檢查無法中斷本身永不返回的 write 呼叫。
統計從 APP 成功取得 SDK frame 開始。SDK ID 連續不能證明更上游沒有丟失;DXGI 接受 Present 不代表實體螢幕已顯示,QAudioSink 接受 PCM 也不代表已實際發聲。已丟掉的原始資料無法靠這些處理補回。
擷取 API/驅動不修改。新版 APP 需配套的新版 gvfg_preview.dll。後續 GPU 優化修改了共用的轉換原始碼;若要發佈包含該優化的 SDK GPU buffer converter,也需重建其 DLL。尚待 build、播放/預覽異常測試與硬體長測;靜態檢查不能證明零丟失。