diff options
author | wm4 <wm4@nowhere> | 2014-10-01 17:12:46 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-01 17:29:24 +0200 |
commit | 64fb37c173e0ecee0e62d78b96c03d609845e8a4 (patch) | |
tree | 32ae8d767f10544a529d0779152f61cc6140af34 /video/out/vo_vdpau.c | |
parent | 7759c182cba7fa2e28f70366bb2be0fb71b7230c (diff) | |
download | mpv-64fb37c173e0ecee0e62d78b96c03d609845e8a4.tar.bz2 mpv-64fb37c173e0ecee0e62d78b96c03d609845e8a4.tar.xz |
vo_vdpau: don't try to create surfaces of size 0
At least on kwin, we decide to proceed without waiting for the window
being mapped (due to the frame exts hack, see commit 8c002b79). But that
leaves us with a window size of 0x0, which causes VdpOutputSurfaceCreate
to fail. This prints some warnings, although vo_vdpau recovers later and
this has no other bad consequences.
Do the following things to deal with this:
- set the "known" window size to the suggested window size before the
window is even created
- allow calling XGetGeometry on the window even if the window is not
mapped yet (this should work just fine)
- make the output surface minimum size 1x1
Strictly speaking, only one of these would be required to make the
warning disappear, but they're all valid changes and increase robustness
and correctness. At no point we use a window size of 0x0 as magic value
for "unset" or unknown size, so keeping it unset has no purpose anyway.
CC: @mpv-player/stable
Diffstat (limited to 'video/out/vo_vdpau.c')
-rw-r--r-- | video/out/vo_vdpau.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index e6acc4067e..c8836a8639 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -234,6 +234,13 @@ static void forget_frames(struct vo *vo, bool seek_reset) vc->dropped_frame = false; } +static int s_size(int s, int disp) +{ + disp = MPMAX(1, disp); + s += s / 2; + return s >= disp ? s : disp; +} + static void resize(struct vo *vo) { struct vdpctx *vc = vo->priv; @@ -259,16 +266,8 @@ static void resize(struct vo *vo) if (vc->output_surface_width < vo->dwidth || vc->output_surface_height < vo->dheight) { - if (vc->output_surface_width < vo->dwidth) { - vc->output_surface_width += vc->output_surface_width >> 1; - vc->output_surface_width = FFMAX(vc->output_surface_width, - vo->dwidth); - } - if (vc->output_surface_height < vo->dheight) { - vc->output_surface_height += vc->output_surface_height >> 1; - vc->output_surface_height = FFMAX(vc->output_surface_height, - vo->dheight); - } + vc->output_surface_width = s_size(vc->output_surface_width, vo->dwidth); + vc->output_surface_height = s_size(vc->output_surface_height, vo->dheight); // Creation of output_surfaces for (int i = 0; i < vc->num_output_surfaces; i++) if (vc->output_surfaces[i] != VDP_INVALID_HANDLE) { |