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
99 struct pl_color_space swapchain_csp;99 struct pl_color_space swapchain_csp;
100 100
101 int64_t perf_freq;101 int64_t perf_freq;
102 unsigned sync_refresh_count;102 unsigned last_sync_refresh_count;
103 int64_t sync_qpc_time;103 int64_t last_sync_qpc_time;
104 int64_t vsync_duration_qpc;104 int64_t vsync_duration_qpc;
105 int64_t last_submit_qpc;105 int64_t last_submit_qpc;
106};106};
@@ -273,33 +273,28 @@ static void d3d11_get_vsync(struct ra_swapchain *sw, struct vo_vsync_info *info) · 166 unmodified lines
273 DXGI_FRAME_STATISTICS stats;273 DXGI_FRAME_STATISTICS stats;
274 hr = IDXGISwapChain_GetFrameStatistics(p->swapchain, &stats);274 hr = IDXGISwapChain_GetFrameStatistics(p->swapchain, &stats);
275 if (hr == DXGI_ERROR_FRAME_STATISTICS_DISJOINT) {275 if (hr == DXGI_ERROR_FRAME_STATISTICS_DISJOINT) {
276 p->sync_refresh_count = 0;276 p->last_sync_refresh_count = 0;
277 p->sync_qpc_time = 0;277 p->last_sync_qpc_time = 0;
278 }278 }
279 if (FAILED(hr))279 if (FAILED(hr))
280 return;280 return;
281 281
282 info->last_queue_display_time = 0;
283 info->vsync_duration = 0;
284 // Detecting skipped vsyncs is possible but not supported yet282 // Detecting skipped vsyncs is possible but not supported yet
285 info->skipped_vsyncs = -1;283 info->skipped_vsyncs = -1;
286 284
287 // Get the number of physical vsyncs that have passed since the start of the285 // Get the number of physical vsyncs that have passed since the last call.
288 // playback or disjoint event.
289 // Check for 0 here, since sometimes GetFrameStatistics returns S_OK but286 // Check for 0 here, since sometimes GetFrameStatistics returns S_OK but
290 // with 0s in some (all?) members of DXGI_FRAME_STATISTICS.287 // with 0s in some (all?) members of DXGI_FRAME_STATISTICS.
291 unsigned src_passed = 0;288 unsigned src_passed = 0;
292 if (stats.SyncRefreshCount && p->sync_refresh_count)289 if (stats.SyncRefreshCount && p->last_sync_refresh_count)
293 src_passed = stats.SyncRefreshCount - p->sync_refresh_count;290 src_passed = stats.SyncRefreshCount - p->last_sync_refresh_count;
294 if (p->sync_refresh_count == 0)291 p->last_sync_refresh_count = stats.SyncRefreshCount;
295 p->sync_refresh_count = stats.SyncRefreshCount;
296 292
297 // Get the elapsed time passed between the above vsyncs293 // Get the elapsed time passed between the above vsyncs
298 unsigned sqt_passed = 0;294 unsigned sqt_passed = 0;
299 if (stats.SyncQPCTime.QuadPart && p->sync_qpc_time)295 if (stats.SyncQPCTime.QuadPart && p->last_sync_qpc_time)
300 sqt_passed = stats.SyncQPCTime.QuadPart - p->sync_qpc_time;296 sqt_passed = stats.SyncQPCTime.QuadPart - p->last_sync_qpc_time;
301 if (p->sync_qpc_time == 0)297 p->last_sync_qpc_time = stats.SyncQPCTime.QuadPart;
302 p->sync_qpc_time = stats.SyncQPCTime.QuadPart;
303 298
304 // If any vsyncs have passed, estimate the physical frame rate299 // If any vsyncs have passed, estimate the physical frame rate
305 if (src_passed && sqt_passed)300 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