frontends/va: Also map VAImageBufferType for reading
VAImageBufferType can be used for both reading and writing, so map it as such. Reviewed-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24390>
This commit is contained in:
@@ -131,6 +131,7 @@ 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,
|
||||
@@ -149,9 +150,19 @@ vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff)
|
||||
else
|
||||
map_func = drv->pipe->texture_map;
|
||||
|
||||
*pbuff = map_func(drv->pipe, resource, 0,
|
||||
buf->type == VAEncCodedBufferType ?
|
||||
PIPE_MAP_READ : PIPE_MAP_WRITE,
|
||||
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,
|
||||
&box, &buf->derived_surface.transfer);
|
||||
mtx_unlock(&drv->mutex);
|
||||
|
||||
|
Reference in New Issue
Block a user