From 5261d1b099edf16712582790085f4d369438dfe5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 3 Nov 2017 15:11:14 +0100 Subject: vo_gpu: don't re-render hwdec frames when repeating frames Repeating frames (for display-sync) is not supposed to render the entire frame again. When using hardware decoding, it unfortunately did: the renderer uses the frame ID to check whether the frame data changed, and unmapping the hwdec frame clears it. Essentially reverts commit 761eeacf5407cab07. Back then I probably thought it would be a good idea to release the hwdec image quickly in order to return it to the decoder, but they're referenced anyway. This should increase the performance and reduce GPU work. --- video/out/gpu/video.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'video') diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index eca74b4bb3..fd870a2ffc 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -894,20 +894,6 @@ static void init_video(struct gl_video *p) gl_video_setup_hooks(p); } -// Release any texture mappings associated with the current frame. -static void unmap_current_image(struct gl_video *p) -{ - struct video_image *vimg = &p->image; - - if (vimg->hwdec_mapped) { - assert(p->hwdec_active && p->hwdec_mapper); - ra_hwdec_mapper_unmap(p->hwdec_mapper); - memset(vimg->planes, 0, sizeof(vimg->planes)); - vimg->hwdec_mapped = false; - vimg->id = 0; // needs to be mapped again - } -} - static struct dr_buffer *gl_find_dr_buffer(struct gl_video *p, uint8_t *ptr) { for (int i = 0; i < p->num_dr_buffers; i++) { @@ -948,10 +934,18 @@ again:; static void unref_current_image(struct gl_video *p) { - unmap_current_image(p); - p->image.id = 0; + struct video_image *vimg = &p->image; + + if (vimg->hwdec_mapped) { + assert(p->hwdec_active && p->hwdec_mapper); + ra_hwdec_mapper_unmap(p->hwdec_mapper); + memset(vimg->planes, 0, sizeof(vimg->planes)); + vimg->hwdec_mapped = false; + } - mp_image_unrefp(&p->image.mpi); + vimg->id = 0; + + mp_image_unrefp(&vimg->mpi); // While we're at it, also garbage collect pending fences in here to // get it out of the way. @@ -3089,8 +3083,6 @@ void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame, done: - unmap_current_image(p); - debug_check_gl(p, "after video rendering"); if (p->osd) { -- cgit v1.2.3