History

Revert "d3d11: calc vsync interval on real stats, not just last interval"

The values provided since last disjoint event may include significant error in case there are periods of slower presentation. We should look at more localized/current values of presentation. For more accurate approximation of vsync rate I plan to add better algorithm to calculate it. Revert this commit alone as it is not neccessary and gives as separation from other changes for better regression testing. This reverts commit f27767f59e2dd459b909b00187b27f3c6fb72a20.

Kacper Michajłow committed 2 years ago

Commit d3b251b1 parent e95af5b1 file · +11 −16Browse files

Unified · Split

video/out/d3d11/context.c+11−16
@@ -99,8 +99,8 @@ struct priv { · 98 unmodified lines
9999 struct pl_color_space swapchain_csp;
100100
101101 int64_t perf_freq;
102− unsigned sync_refresh_count;
103− int64_t sync_qpc_time;
102+ unsigned last_sync_refresh_count;
103+ int64_t last_sync_qpc_time;
104104 int64_t vsync_duration_qpc;
105105 int64_t last_submit_qpc;
106106 };
@@ -273,33 +273,28 @@ static void d3d11_get_vsync(struct ra_swapchain *sw, struct vo_vsync_info *info) · 166 unmodified lines
273273 DXGI_FRAME_STATISTICS stats;
274274 hr = IDXGISwapChain_GetFrameStatistics(p->swapchain, &stats);
275275 if (hr == DXGI_ERROR_FRAME_STATISTICS_DISJOINT) {
276− p->sync_refresh_count = 0;
277− p->sync_qpc_time = 0;
276+ p->last_sync_refresh_count = 0;
277+ p->last_sync_qpc_time = 0;
278278 }
279279 if (FAILED(hr))
280280 return;
281281
282− info->last_queue_display_time = 0;
283− info->vsync_duration = 0;
284282 // Detecting skipped vsyncs is possible but not supported yet
285283 info->skipped_vsyncs = -1;
286284
287− // Get the number of physical vsyncs that have passed since the start of the
288− // playback or disjoint event.
285+ // Get the number of physical vsyncs that have passed since the last call.
289286 // Check for 0 here, since sometimes GetFrameStatistics returns S_OK but
290287 // with 0s in some (all?) members of DXGI_FRAME_STATISTICS.
291288 unsigned src_passed = 0;
292− if (stats.SyncRefreshCount && p->sync_refresh_count)
293− src_passed = stats.SyncRefreshCount - p->sync_refresh_count;
294− if (p->sync_refresh_count == 0)
295− p->sync_refresh_count = stats.SyncRefreshCount;
289+ if (stats.SyncRefreshCount && p->last_sync_refresh_count)
290+ src_passed = stats.SyncRefreshCount - p->last_sync_refresh_count;
291+ p->last_sync_refresh_count = stats.SyncRefreshCount;
296292
297293 // Get the elapsed time passed between the above vsyncs
298294 unsigned sqt_passed = 0;
299− if (stats.SyncQPCTime.QuadPart && p->sync_qpc_time)
300− sqt_passed = stats.SyncQPCTime.QuadPart - p->sync_qpc_time;
301− if (p->sync_qpc_time == 0)
302− p->sync_qpc_time = stats.SyncQPCTime.QuadPart;
295+ if (stats.SyncQPCTime.QuadPart && p->last_sync_qpc_time)
296+ sqt_passed = stats.SyncQPCTime.QuadPart - p->last_sync_qpc_time;
297+ p->last_sync_qpc_time = stats.SyncQPCTime.QuadPart;
303298
304299 // If any vsyncs have passed, estimate the physical frame rate
305300 if (src_passed && sqt_passed)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t