summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-27 16:48:45 +0200
committerwm4 <wm4@nowhere>2013-09-27 17:59:44 +0200
commit4d2f354da651a3c1fd9776ed5829f57961a46c10 (patch)
treeaade31a57f48ec4b387ba19077154fca5012f62f /video/decode
parentede652774ee83d2d311763358a1d3b820d9f5e17 (diff)
downloadmpv-4d2f354da651a3c1fd9776ed5829f57961a46c10.tar.bz2
mpv-4d2f354da651a3c1fd9776ed5829f57961a46c10.tar.xz
vaapi: potentially make reading surfaces back to system RAM faster
Don't allocate a VAImage and a mp_image every time. VAImage are cached in the surfaces themselves, and for mp_image an explicit pool is created. The retry loop runs only once for each surface now. This also makes use of vaDeriveImage() if possible.
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/vaapi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c
index 82c46de81e..d7ee5b35dc 100644
--- a/video/decode/vaapi.c
+++ b/video/decode/vaapi.c
@@ -32,6 +32,7 @@
#include "mpvcore/av_common.h"
#include "video/fmt-conversion.h"
#include "video/vaapi.h"
+#include "video/mp_image_pool.h"
#include "video/decode/dec_video.h"
#include "video/filter/vf.h"
@@ -68,6 +69,7 @@ struct priv {
struct va_surface_pool *pool;
int rt_format;
+ struct mp_image_pool *sw_pool;
bool printed_readback_warning;
};
@@ -414,6 +416,7 @@ static int init_with_vactx(struct lavc_ctx *ctx, struct mp_vaapi_ctx *vactx)
p->display = p->ctx->display;
p->pool = va_surface_pool_alloc(p->display, p->rt_format);
+ p->sw_pool = talloc_steal(p, mp_image_pool_new(17));
p->va_context->display = p->display;
p->va_context->config_id = VA_INVALID_ID;
@@ -466,7 +469,7 @@ static struct mp_image *copy_image(struct lavc_ctx *ctx, struct mp_image *img)
struct va_surface *surface = va_surface_in_mp_image(img);
if (surface) {
struct mp_image *simg =
- va_surface_download(surface, p->ctx->image_formats);
+ va_surface_download(surface, p->ctx->image_formats, p->sw_pool);
if (simg) {
if (!p->printed_readback_warning) {
mp_msg(MSGT_VO, MSGL_WARN, "[vaapi] Using GPU readback. This "