Add backend diagnostics for capture stalls

- add rotating XDMA backend and Qt preview logs
- expose IRQ, DMA, ring, and delivery debug state
- record IRQ wait heartbeats and register state
- make XDMA tracing configurable through CMake
- prevent preview status queries from blocking rendering
- recover from D3D swapchain and Present failures
- add debug API struct size validation
- avoid stale MainWindow object-size stack corruption
This commit is contained in:
Mark.lin
2026-06-18 10:24:34 +08:00
parent 42502ef701
commit 92b5fb1464
11 changed files with 616 additions and 73 deletions
+18 -1
View File
@@ -3,12 +3,14 @@
#include <gvfg_capture.h>
#include <gvfg_preview.h>
#include <QFile>
#include <QString>
#include <QWidget>
#include <array>
#include <atomic>
#include <cstdint>
#include <mutex>
#include <thread>
class QCloseEvent;
@@ -47,20 +49,35 @@ private:
void updateSignalStatus(bool writeLog);
void updateUiState();
void showError(const QString &apiName, gvfg_status_t status);
void openLogFile();
bool openLogFilePart();
void rotateLogFileIfNeeded();
void writeLogFileLine(const QString &line);
void appendLog(const QString &message);
void captureReadLoop();
void joinCaptureThread();
static constexpr qint64 kMaxLogFileBytes = 20ll * 1024ll * 1024ll;
Ui::MainWindow *ui_ = nullptr;
PreviewWindow *previewWindow_ = nullptr;
std::array<gvfg_device_info_t, GVFG_MAX_DEVICES> devices_{};
int deviceCount_ = 0;
gvfg_handle handle_ = nullptr;
gvfg_preview_handle previewHandle_ = nullptr;
bool captureRunning_ = false;
std::atomic<bool> captureRunning_{false};
std::atomic<bool> captureStop_{false};
std::thread captureThread_;
std::atomic<uint64_t> frameCount_{0};
uint64_t previewFailureCount_ = 0;
QTimer *signalStatusTimer_ = nullptr;
QString lastSignalStatusText_;
QFile logFile_;
std::mutex logFileMutex_;
QString logDirPath_;
QString logFilePath_;
QString logSessionStamp_;
int logPartIndex_ = 1;
};
QWidget *createMainWindow();