0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

vaapi: use GPU memcpy for reading back from HW surface

This makes it much faster if the surface is really mapped from GPU
memory. It's slightly slower than system memcpy if used on system
memory. We don't really know definitely in which type of memory
it's located, so we use the GPU memcpy in all cases.

Fixes #2317.
This commit is contained in:
wm4 2015-09-25 18:58:49 +02:00
parent 0ae8aebb89
commit ac5538c7df
3 changed files with 7 additions and 2 deletions

View File

@ -439,7 +439,11 @@ static struct mp_image *try_download(struct mp_image *src,
mp_image_set_size(&tmp, src->w, src->h); // copy only visible part
dst = mp_image_pool_get(pool, tmp.imgfmt, tmp.w, tmp.h);
if (dst) {
mp_image_copy(dst, &tmp);
va_lock(p->ctx);
mp_check_gpu_memcpy(p->ctx->log, &p->ctx->gpu_memcpy_message);
va_unlock(p->ctx);
mp_image_copy_gpu(dst, &tmp);
mp_image_copy_attributes(dst, src);
}
va_image_unmap(p->ctx, image);

View File

@ -48,6 +48,7 @@ struct mp_vaapi_ctx {
struct mp_log *log;
VADisplay display;
struct va_image_formats *image_formats;
bool gpu_memcpy_message;
pthread_mutex_t lock;
};

View File

@ -772,7 +772,7 @@ hwaccel_features = [
}, {
'name': 'sse4-intrinsics',
'desc': 'GCC SSE4 intrinsics for GPU memcpy',
'deps_any': [ 'dxva2-hwaccel' ],
'deps_any': [ 'dxva2-hwaccel', 'vaapi-hwaccel' ],
'func': check_cc(fragment=load_fragment('sse.c')),
}
]