summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-14 22:36:59 +0100
committerwm4 <wm4@nowhere>2015-03-14 22:36:59 +0100
commita1b3af5df32558ddcf67432a706a7280f81c5f2d (patch)
tree8f0656c5e6dd42918c43ee42ca961ac5a052849d
parenta0e747ab357fdad41a3c020ba0435c5d582039b6 (diff)
downloadmpv-a1b3af5df32558ddcf67432a706a7280f81c5f2d.tar.bz2
mpv-a1b3af5df32558ddcf67432a706a7280f81c5f2d.tar.xz
vo_opengl: silence vdpau hwdec warnings with smoothmotion
Since the gl_rework merge, this started to print some OpenGL errors when using vdpau hardware decoding with vo_opengl smoothmotion. This happens because some hwdec unmap_image call were not paired with a map_image call. Unlike the old vo_opengl, the new code does not do this out of convenience (it would be a pain to track this exactly). It was triggered by smoothmotion, because not every rendered frame has actually a new input video frame (i.e. no map_image call, but it called unmap_image anyway). Solve this by handling unmapping differently in the vdpau code. The next commit will remove the unmap_image callback completely. Fixes #1687.
-rw-r--r--video/out/gl_hwdec_vdpau.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/video/out/gl_hwdec_vdpau.c b/video/out/gl_hwdec_vdpau.c
index f0086b35a5..fc341b1637 100644
--- a/video/out/gl_hwdec_vdpau.c
+++ b/video/out/gl_hwdec_vdpau.c
@@ -40,6 +40,7 @@ struct priv {
GLvdpauSurfaceNV vdpgl_surface;
VdpOutputSurface vdp_surface;
struct mp_vdpau_mixer *mixer;
+ bool mapped;
};
static void mark_vdpau_objects_uninitialized(struct gl_hwdec *hw)
@@ -48,6 +49,7 @@ static void mark_vdpau_objects_uninitialized(struct gl_hwdec *hw)
p->vdp_surface = VDP_INVALID_HANDLE;
p->mixer->video_mixer = VDP_INVALID_HANDLE;
+ p->mapped = false;
}
static void destroy_objects(struct gl_hwdec *hw)
@@ -57,6 +59,10 @@ static void destroy_objects(struct gl_hwdec *hw)
struct vdp_functions *vdp = &p->ctx->vdp;
VdpStatus vdp_st;
+ if (p->mapped)
+ gl->VDPAUUnmapSurfacesNV(1, &p->vdpgl_surface);
+ p->mapped = false;
+
if (p->vdpgl_surface)
gl->VDPAUUnregisterSurfaceNV(p->vdpgl_surface);
p->vdpgl_surface = 0;
@@ -182,19 +188,19 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image,
if (!p->vdpgl_surface)
return -1;
+ if (p->mapped)
+ gl->VDPAUUnmapSurfacesNV(1, &p->vdpgl_surface);
+
mp_vdpau_mixer_render(p->mixer, NULL, p->vdp_surface, NULL, hw_image, NULL);
gl->VDPAUMapSurfacesNV(1, &p->vdpgl_surface);
+ p->mapped = true;
out_textures[0] = p->gl_texture;
return 0;
}
static void unmap_image(struct gl_hwdec *hw)
{
- struct priv *p = hw->priv;
- GL *gl = hw->gl;
-
- gl->VDPAUUnmapSurfacesNV(1, &p->vdpgl_surface);
}
const struct gl_hwdec_driver gl_hwdec_vdpau = {