summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2019-09-24 23:05:37 +1000
committerJan Ekström <jeebjp@gmail.com>2019-09-26 23:41:38 +0300
commit03cb8755e18cafa81acbcedb81a390a684a46021 (patch)
treef1d02fe4e1597fd76ef860c2859afcd2f9e8ed5c
parent9d4f16b10def386ca6c2b18f2e0e5850d619230b (diff)
downloadmpv-03cb8755e18cafa81acbcedb81a390a684a46021.tar.bz2
mpv-03cb8755e18cafa81acbcedb81a390a684a46021.tar.xz
vo_gpu: d3d11: don't reset frame stats after pause
I think I was wrong about having to reset the stats when mpv stops producing frames, eg. when it's paused. As long as the swapchain doesn't underflow, last_queue_display_time will still be accurate, because the next frame produced should still be presented one vsync after the last one in the swapchain. If the swapchain underflows (which is the common case for when mpv is paused for more than 150ms,) the next predicted frame time should be in the past. It should be fine to leave last_queue_display_time unset in this case, since vo.c will use the current time instead, which is a decent guess (though it doesn't take vsync phase into account.) last_sync_refresh_count and last_sync_qpc_time should be kept on swapchain underflow as well. Assuming the display refresh rate doesn't change while mpv is paused, they'll only provide a more accurate guess of the vsync duration when mpv starts playing again. Also, vsync_duration_qpc never needs to get reset. It will get overwritten immediately in most cases, and when it doesn't, it's still a better guess of the vsync duration than nothing.
-rw-r--r--video/out/d3d11/context.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c
index fd867c243e..f596fb09d4 100644
--- a/video/out/d3d11/context.c
+++ b/video/out/d3d11/context.c
@@ -203,7 +203,6 @@ static void d3d11_get_vsync(struct ra_swapchain *sw, struct vo_vsync_info *info)
if (hr == DXGI_ERROR_FRAME_STATISTICS_DISJOINT) {
p->last_sync_refresh_count = 0;
p->last_sync_qpc_time = 0;
- p->vsync_duration_qpc = 0;
}
if (FAILED(hr))
return;
@@ -260,15 +259,7 @@ static void d3d11_get_vsync(struct ra_swapchain *sw, struct vo_vsync_info *info)
static int d3d11_control(struct ra_ctx *ctx, int *events, int request, void *arg)
{
- struct priv *p = ctx->priv;
-
int ret = vo_w32_control(ctx->vo, events, request, arg);
- if (request == VOCTRL_RESUME) {
- // Reset frame statistics after pause
- p->last_sync_refresh_count = 0;
- p->last_sync_qpc_time = 0;
- p->vsync_duration_qpc = 0;
- }
if (*events & VO_EVENT_RESIZE) {
if (!resize(ctx))
return VO_ERROR;