summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2020-05-05 23:25:22 +1000
committerJames Ross-Gowan <rossy@jrg.systems>2020-05-07 00:17:50 +1000
commit326c55a5713b9aa54317873554c1d11e4dfffe9f (patch)
treed392c321481b9dbc532c3545cbd14b8f5c3358b6
parentebac24efe64fd103a98ccc6b3a1af839d31974a3 (diff)
downloadmpv-326c55a5713b9aa54317873554c1d11e4dfffe9f.tar.bz2
mpv-326c55a5713b9aa54317873554c1d11e4dfffe9f.tar.xz
vo_gpu: d3d11: only use presentation feedback with flip model
The current implementation of presentation feedback was designed to be used with flip model presentation. With the bitblt model, GetFrameStatistics returns totally different values and it's not clear if we can use them at all. Previously, this wasn't a problem because with the bitblt model, GetFrameStatistics only worked in exclusive fullscreen. Now that mpv supports exclusive fullscreen, we should explicitly check for a flip model swapchain before using presentation feedback.
-rw-r--r--video/out/d3d11/context.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c
index 881962f3be..b77e328b70 100644
--- a/video/out/d3d11/context.c
+++ b/video/out/d3d11/context.c
@@ -258,6 +258,15 @@ static void d3d11_get_vsync(struct ra_swapchain *sw, struct vo_vsync_info *info)
if (p->opts->sync_interval != 1)
return;
+ // They're also only valid for flip model swapchains
+ DXGI_SWAP_CHAIN_DESC desc;
+ hr = IDXGISwapChain_GetDesc(p->swapchain, &desc);
+ if (FAILED(hr) || (desc.SwapEffect != DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL &&
+ desc.SwapEffect != DXGI_SWAP_EFFECT_FLIP_DISCARD))
+ {
+ return;
+ }
+
// GetLastPresentCount returns a sequential ID for the frame submitted by
// the last call to IDXGISwapChain::Present()
UINT submit_count;
@@ -308,10 +317,9 @@ static void d3d11_get_vsync(struct ra_swapchain *sw, struct vo_vsync_info *info)
stats.PresentRefreshCount && stats.SyncRefreshCount &&
stats.SyncQPCTime.QuadPart)
{
- // PresentRefreshCount and SyncRefreshCount might refer to different
- // frames (this can definitely occur in bitblt-mode.) Assuming mpv
- // presents on every frame, guess the present count that relates to
- // SyncRefreshCount.
+ // It's not clear if PresentRefreshCount and SyncRefreshCount can refer
+ // to different frames, but in case they can, assuming mpv presents on
+ // every frame, guess the present count that relates to SyncRefreshCount.
unsigned expected_sync_pc = stats.PresentCount +
(stats.SyncRefreshCount - stats.PresentRefreshCount);