frontends/va: Map VAEncCodedBufferType buffer as PIPE_MAP_READ

VAEncCodedBufferType is used for reading back encoded data.
Mapping it for read instead of write speeds up reading
the data on CPU.

On radeonsi this will result in VRAM copy to staging buffer
in cached GTT, making the CPU read much faster.

Signed-off-by: David Rosca <nowrep@gmail.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20376>
This commit is contained in:
David Rosca 2022-12-18 18:01:37 +01:00 committed by Marge Bot
parent e832d6a1bb
commit 9873ccb071

View file

@ -149,7 +149,9 @@ vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff)
else
map_func = drv->pipe->texture_map;
*pbuff = map_func(drv->pipe, resource, 0, PIPE_MAP_WRITE,
*pbuff = map_func(drv->pipe, resource, 0,
buf->type == VAEncCodedBufferType ?
PIPE_MAP_READ : PIPE_MAP_WRITE,
&box, &buf->derived_surface.transfer);
mtx_unlock(&drv->mutex);