diff options
author | Dudemanguy <random342@airmail.cc> | 2023-09-17 21:34:32 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-10 19:10:55 +0000 |
commit | a899e14bccb667af243f8fce454160e17ae45c2a (patch) | |
tree | 77fede3fe581c4cedbe6cf04f456e16937374dfb /video/out/drm_common.c | |
parent | c82c55b4b9d4015ba79fb36170defb328563cdea (diff) | |
download | mpv-a899e14bccb667af243f8fce454160e17ae45c2a.tar.bz2 mpv-a899e14bccb667af243f8fce454160e17ae45c2a.tar.xz |
vo: change vo->driver->wait_events to nanoseconds
In many cases, this is purely cosmetic because poll still only accepts
microseconds. There's still a gain here however since
pthread_cond_timedwait can take a realtime ts now.
Additionally, 37d6604d70c8c594de2817db26356c4c950ac0fd changed the value
added to timeout_ms in X11 and Wayland to ensure that it would never be
0 and rounded up. This was both incomplete, several other parts of the
player have this same problem like drm, and not really needed. Instead
the MPCLAMP is just adjusted to have a min of 1.
Diffstat (limited to 'video/out/drm_common.c')
-rw-r--r-- | video/out/drm_common.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/video/out/drm_common.c b/video/out/drm_common.c index 4f235956ad..dd53793dbb 100644 --- a/video/out/drm_common.c +++ b/video/out/drm_common.c @@ -1304,15 +1304,15 @@ void vo_drm_set_monitor_par(struct vo *vo) MP_VERBOSE(drm, "Monitor pixel aspect: %g\n", vo->monitor_par); } -void vo_drm_wait_events(struct vo *vo, int64_t until_time_us) +void vo_drm_wait_events(struct vo *vo, int64_t until_time_ns) { struct vo_drm_state *drm = vo->drm; if (drm->vt_switcher_active) { - int64_t wait_us = until_time_us - mp_time_us(); - int timeout_ms = MPCLAMP((wait_us + 500) / 1000, 0, 10000); + int64_t wait_ns = until_time_ns - mp_time_ns(); + int timeout_ms = MPCLAMP(wait_ns / 1e6, 1, 10000); vt_switcher_poll(&drm->vt_switcher, timeout_ms); } else { - vo_wait_default(vo, until_time_us); + vo_wait_default(vo, until_time_ns); } } |