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:
parent
0ae8aebb89
commit
ac5538c7df
@ -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);
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user