Refine GVFG preview pacing and error reporting
- Replace non-blocking Present retries with Present(0, 0), allowing DXGI to wait for presentation dependencies on the dedicated preview worker. - Change preview admission from newest-frame replacement to bounded FIFO delivery with three pending/upload reservations and one presenting slot. - Expire queued preview frames after 50 ms before GPU processing and skip new preview submissions only when the bounded slot capacity is full. - Track queue order and queue age without retaining SDK-owned frame memory; capture continues releasing each SDK frame after the synchronous upload. - Service only synchronous Windows sent messages while waiting for preview mutexes, worker shutdown, idle drain, and capture-thread join to avoid an HWND-owner/DXGI deadlock without dispatching queued application callbacks. - Preserve internal preview pacing and audio queue counters while removing expected busy, expired, and audio-eviction reports from the normal UI log. - Reserve delivery error logs for preview/render failures, video or audio frame-ID anomalies, audio write failures, and final accounting mismatches. - Remove the normal stop summary and the audio queue-drop field from the status display so expected pacing adjustments are not presented as faults. - Update the public preview comments and diagnostic documentation for the FIFO capacity, queue-age boundary, blocking Present behavior, and log policy. - Keep the capture SDK, driver interfaces, frame ownership, GPU conversion precision, and public delivery-statistics structure unchanged. Validation: - User testing reported approximately 18% GPU utilization for one 1920x1080 Y210 10-bit preview channel. This was not independently benchmarked. - A user-provided long-run log contained 13,715,695 received video frames with no preview render failures; periodic preview skips matched the confirmed 60.000 FPS versus 59.94 Hz pacing difference. - The same log showed periodic audio playback-queue eviction without audio frame-ID gaps or write failures; this is retained as internal diagnostic accounting rather than reported as a source-delivery error. - Static source review and git diff --check passed. No application, shader, or driver build was performed by the agent, and runtime deadlock behavior has not been independently reproduced or validated.
This commit is contained in:
@@ -1327,28 +1327,8 @@ gvfg_preview_present_result_t D3DPreviewPipeline::present_preview(int src_w, int
|
||||
ID3D11ShaderResourceView *nullSrv[1] = {nullptr};
|
||||
ctx_->PSSetShaderResources(0, 1, nullSrv);
|
||||
|
||||
return retry_preview_present();
|
||||
}
|
||||
|
||||
gvfg_preview_present_result_t D3DPreviewPipeline::retry_preview_present()
|
||||
{
|
||||
if (!preview_swapchain_)
|
||||
return GVFG_PREVIEW_PRESENT_FAILED;
|
||||
HRESULT hr = preview_swapchain_->Present(0, DXGI_PRESENT_DO_NOT_WAIT);
|
||||
if (hr == DXGI_ERROR_WAS_STILL_DRAWING)
|
||||
{
|
||||
static uint64_t s_presentBusyCount = 0;
|
||||
++s_presentBusyCount;
|
||||
if (s_presentBusyCount <= 5 || (s_presentBusyCount % 60) == 0)
|
||||
{
|
||||
char warn[256] = {};
|
||||
std::snprintf(warn, sizeof(warn),
|
||||
"[SharedScene] preview present skipped: swapchain busy count=%llu",
|
||||
static_cast<unsigned long long>(s_presentBusyCount));
|
||||
ssp_log_text(warn);
|
||||
}
|
||||
return GVFG_PREVIEW_PRESENT_SKIPPED;
|
||||
}
|
||||
// Let DXGI wait for presentation dependencies; no application retry loop.
|
||||
HRESULT hr = preview_swapchain_->Present(0, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
char err[256] = {};
|
||||
|
||||
@@ -53,8 +53,6 @@ public:
|
||||
bool ensure_preview_swapchain(int w, int h);
|
||||
bool preview_swapchain_10bit() const { return preview_swapchain_10bit_; }
|
||||
gvfg_preview_present_result_t present_preview(int src_w, int src_h);
|
||||
// Retry a busy Present while the caller retains exclusive context access.
|
||||
gvfg_preview_present_result_t retry_preview_present();
|
||||
bool clear_preview_black();
|
||||
DXGI_FORMAT preview_backbuffer_format() const;
|
||||
DXGI_FORMAT scene_texture_format() const;
|
||||
|
||||
Reference in New Issue
Block a user