mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
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.
This commit is contained in:
parent
a0e747ab35
commit
a1b3af5df3
@ -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 = {
|
||||
|
Loading…
Reference in New Issue
Block a user