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>
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);