Revert "frontends/va: Also map VAImageBufferType for reading"

This reverts commit 12a4f2c132.

With PIPE_MAP_READ_WRITE and derived image, the encoder will copy
to and from staging buffer for each frame, which caused performance
degradation, even worse than putImage.

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25128>
This commit is contained in:
Leo Liu 2023-09-08 14:58:43 -04:00 committed by Marge Bot
parent 7eabe9bb40
commit 8c8985390d

View file

@ -135,7 +135,6 @@ vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff)
if (buf->derived_surface.resource) {
struct pipe_resource *resource;
struct pipe_box box;
unsigned usage;
void *(*map_func)(struct pipe_context *,
struct pipe_resource *resource,
unsigned level,
@ -154,19 +153,11 @@ vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff)
else
map_func = drv->pipe->texture_map;
switch (buf->type) {
case VAEncCodedBufferType:
usage = PIPE_MAP_READ;
break;
case VAImageBufferType:
usage = PIPE_MAP_READ_WRITE;
break;
default:
usage = PIPE_MAP_WRITE;
break;
}
*pbuff = map_func(drv->pipe, resource, 0, usage,
/* For VAImageBufferType, use PIPE_MAP_WRITE for now,
* PIPE_MAP_READ_WRITE degradate perf with two copies when map/unmap. */
*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);