summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-11-03 15:11:14 +0100
committerwm4 <wm4@nowhere>2017-11-03 15:11:56 +0100
commit5261d1b099edf16712582790085f4d369438dfe5 (patch)
treebed69f41692667b41514cd60615e05d6fa74b296
parent4fca1856e15e5294fb127ffd9d9a434ec4a2c2df (diff)
downloadmpv-5261d1b099edf16712582790085f4d369438dfe5.tar.bz2
mpv-5261d1b099edf16712582790085f4d369438dfe5.tar.xz
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.
-rw-r--r--video/out/gpu/video.c30
1 files changed, 11 insertions, 19 deletions
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) {