From: David Rosca Date: Sun, 18 Dec 2022 17:01:37 +0000 (+0100) Subject: frontends/va: Map VAEncCodedBufferType buffer as PIPE_MAP_READ X-Git-Tag: upstream/23.3.3~13129 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9873ccb07145a882307e8302375319ef61ac2132;p=platform%2Fupstream%2Fmesa.git 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 Reviewed-by: Ruijing Dong Part-of: --- diff --git a/src/gallium/frontends/va/buffer.c b/src/gallium/frontends/va/buffer.c index af035ef..6a8ca44 100644 --- a/src/gallium/frontends/va/buffer.c +++ b/src/gallium/frontends/va/buffer.c @@ -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);