frontents/va: Use PIPE_USAGE_STAGING for coded buffer

Coded buffer will only be read on CPU, setting
PIPE_USAGE_STAGING instead of PIPE_USAGE_STREAM
makes the CPU reads much faster.

On 6700XT this reduces the CPU copy by around
3ms to 0.3 ms on average while under high GPU
load - real-time game streaming.

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/20989>
This commit is contained in:
David Rosca 2023-01-30 16:31:21 +01:00 committed by Marge Bot
parent 2f93398047
commit 09977d687d
2 changed files with 2 additions and 2 deletions

View file

@ -53,7 +53,7 @@ vlVaHandleVAEncPictureParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *cont
coded_buf = handle_table_get(drv->htab, h264->coded_buf);
if (!coded_buf->derived_surface.resource)
coded_buf->derived_surface.resource = pipe_buffer_create(drv->pipe->screen, PIPE_BIND_VERTEX_BUFFER,
PIPE_USAGE_STREAM, coded_buf->size);
PIPE_USAGE_STAGING, coded_buf->size);
context->coded_buf = coded_buf;
if (context->desc.h264enc.is_ltr)

View file

@ -56,7 +56,7 @@ vlVaHandleVAEncPictureParameterBufferTypeHEVC(vlVaDriver *drv, vlVaContext *cont
if (!coded_buf->derived_surface.resource)
coded_buf->derived_surface.resource = pipe_buffer_create(drv->pipe->screen, PIPE_BIND_VERTEX_BUFFER,
PIPE_USAGE_STREAM, coded_buf->size);
PIPE_USAGE_STAGING, coded_buf->size);
context->coded_buf = coded_buf;
context->desc.h265enc.pic.log2_parallel_merge_level_minus2 = h265->log2_parallel_merge_level_minus2;