diff options
author | Uoti Urpala <uau@mplayer2.org> | 2012-07-27 03:40:38 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2012-07-27 03:40:38 +0300 |
commit | 31458a51b5c6a7c8a6449b0b3baa4f3fef6c4938 (patch) | |
tree | a7504628cd47ac9f4df4190a3a95f235c4e8178d /libvo/x11_common.c | |
parent | adfa7bdfb2c61b136b2d15dcae516c0394b2e86b (diff) | |
download | mpv-31458a51b5c6a7c8a6449b0b3baa4f3fef6c4938.tar.bz2 mpv-31458a51b5c6a7c8a6449b0b3baa4f3fef6c4938.tar.xz |
vo_vdpau: disable refresh-aware frame timing when composited
Under a compositing window manager the current VDPAU implementation
behaves differently than without it. Frame flip timing info becomes
incorrect (I guess it only reflects when the frame was sent to the
compositor, not when it was actually shown), and there is no
limitation to at most one frame switch per refresh like without
compositing. Detect whether a compositing window manager is active and
disable refresh-aware frame timing and dropping in this case,
similarly to what fps=-1 would do. This behavior can be controlled
with the new suboption "composite-detect".
Disabling the refresh-aware logic makes timing somewhat less accurate.
Because the video switch rate limit isn't there, the lack of frame
dropping on player side does not impose a hard limit on video FPS, but
does reduce performance somewhat as redundant frames are drawn in
memory.
The existence of a compositing window manager does not guarantee that
the current window is actually composited, so the current check is not
foolproof. In particular, some WMs have support for a "unredirect
fullscreen windows" option. Support for such things could be improved.
Diffstat (limited to 'libvo/x11_common.c')
-rw-r--r-- | libvo/x11_common.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c index ee50ba5575..cf8bb2dc4f 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -337,6 +337,9 @@ static void init_atoms(struct vo_x11_state *x11) XA_INIT(WM_PROTOCOLS); XA_INIT(WM_DELETE_WINDOW); XA_INIT(UTF8_STRING); + char buf[50]; + sprintf(buf, "_NET_WM_CM_S%d", x11->screen); + x11->XA_NET_WM_CM = XInternAtom(x11->display, buf, False); } void update_xinerama_info(struct vo *vo) { @@ -1941,6 +1944,12 @@ uint32_t vo_x11_get_equalizer(const char *name, int *value) return VO_TRUE; } +bool vo_x11_screen_is_composited(struct vo *vo) +{ + struct vo_x11_state *x11 = vo->x11; + return XGetSelectionOwner(x11->display, x11->XA_NET_WM_CM) != None; +} + #ifdef CONFIG_XV int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, const char *name, int value) { |