diff options
author | wm4 <wm4@nowhere> | 2014-08-11 14:03:53 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-08-11 14:03:53 +0200 |
commit | 33a8e2a9adc45b6a2cb80cf669624154bf0eeb7d (patch) | |
tree | b8f179a07fb24e88cc620828a86ee4c3d57a952a /video/vdpau.c | |
parent | ef9b399020742d7a29fc2265ef587d938d78e63a (diff) | |
download | mpv-33a8e2a9adc45b6a2cb80cf669624154bf0eeb7d.tar.bz2 mpv-33a8e2a9adc45b6a2cb80cf669624154bf0eeb7d.tar.xz |
vdpau: allocate surfaces by age
Whether this helps is probably questionable and depends on the GPU. But
the vaapi code does it too.
Diffstat (limited to 'video/vdpau.c')
-rw-r--r-- | video/vdpau.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/video/vdpau.c b/video/vdpau.c index e03d2b7817..754b6d300c 100644 --- a/video/vdpau.c +++ b/video/vdpau.c @@ -179,6 +179,7 @@ static struct mp_image *create_ref(struct mp_vdpau_ctx *ctx, int index) struct surface_entry *e = &ctx->video_surfaces[index]; assert(!e->in_use); e->in_use = true; + e->age = ctx->age_counter++; struct surface_ref *ref = talloc_ptrtype(NULL, ref); *ref = (struct surface_ref){ctx, index}; struct mp_image *res = @@ -237,11 +238,18 @@ static struct mp_image *mp_vdpau_get_surface(struct mp_vdpau_ctx *ctx, assert(e->chroma == chroma); assert(e->rgb_format == rgb_format); assert(e->rgb == rgb); + if (surface_index >= 0) { + struct surface_entry *other = &ctx->video_surfaces[surface_index]; + if (other->age < e->age) + continue; + } surface_index = n; - goto done; } } + if (surface_index >= 0) + goto done; + // Allocate new surface for (int n = 0; n < MAX_VIDEO_SURFACES; n++) { struct surface_entry *e = &ctx->video_surfaces[n]; |