diff options
author | Uoti Urpala <uau@mplayer2.org> | 2012-08-28 19:12:27 +0300 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-09-18 21:04:46 +0200 |
commit | fd52cb65f43d262493724899c7b0fb49971f745d (patch) | |
tree | ae6b38171d67b26ad05aaf107fb48ab8e63ab96e /libvo/vo_vdpau.c | |
parent | 62ccf6c5cccdf1a34a4b85f91615f0f8305b5279 (diff) | |
download | mpv-fd52cb65f43d262493724899c7b0fb49971f745d.tar.bz2 mpv-fd52cb65f43d262493724899c7b0fb49971f745d.tar.xz |
subs, vo: do sub bitmap change detection by comparing IDs
vo_vdpau and vo_gl cache the last subtitle bitmaps uploaded to video
card in case they stay the same over multiple frames. Detecting
whether the bitmaps have changed and should be re-uploaded was
somewhat fragile. Change the VO API to provide a bitmap ID which can
be compared with what the VO has to determine whether a new upload of
the bitmaps is needed.
Conflicts:
libvo/vo_gl.c
Note: the changes for vo_gl.c were not merged. Instead, eosd_packer is
modified to use the new way of detecting EOSD changes. This takes care
of vo_gl, vo_gl3 and vo_direct3d, which all render EOSD. They don't
need to be updated in turn.
Diffstat (limited to 'libvo/vo_vdpau.c')
-rw-r--r-- | libvo/vo_vdpau.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index d9b59c7dbe..922ec24201 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -186,6 +186,8 @@ struct vdpctx { } *eosd_targets, osd_targets[MAX_OLD_OSD_BITMAPS][2]; int eosd_targets_size; int eosd_render_count; + int bitmap_id; + int bitmap_pos_id; // Video equalizer struct mp_csp_equalizer video_eq; @@ -812,6 +814,7 @@ static void mark_vdpau_objects_uninitialized(struct vo *vo) vc->vdp_device = VDP_INVALID_HANDLE; talloc_free(vc->osd_surface.packer); talloc_free(vc->eosd_surface.packer); + vc->bitmap_id = vc->bitmap_pos_id = 0; vc->osd_surface = vc->eosd_surface = (struct eosd_bitmap_surface){ .surface = VDP_INVALID_HANDLE, }; @@ -999,7 +1002,7 @@ static void generate_eosd(struct vo *vo, mp_eosd_images_t *imgs) struct eosd_bitmap_surface *sfc = &vc->eosd_surface; bool need_upload = false; - if (imgs->changed == 0 && sfc->packer) + if (imgs->bitmap_pos_id == vc->bitmap_pos_id) return; // Nothing changed and we still have the old data vc->eosd_render_count = 0; @@ -1007,7 +1010,7 @@ static void generate_eosd(struct vo *vo, mp_eosd_images_t *imgs) if (!imgs->imgs) return; // There's nothing to render! - if (imgs->changed == 1) + if (imgs->bitmap_id == vc->bitmap_id) goto eosd_skip_upload; need_upload = true; @@ -1069,6 +1072,8 @@ eosd_skip_upload: target->dest.y1 = p->h + p->dst_y; vc->eosd_render_count++; } + vc->bitmap_id = imgs->bitmap_id; + vc->bitmap_pos_id = imgs->bitmap_pos_id; } static void record_osd(void *ctx, int x0, int y0, int w, int h, |