diff --git a/src/gallium/frontends/va/buffer.c b/src/gallium/frontends/va/buffer.c index dd160439aa6..c1f4d9d882d 100644 --- a/src/gallium/frontends/va/buffer.c +++ b/src/gallium/frontends/va/buffer.c @@ -173,6 +173,11 @@ VAStatus vlVaMapBuffer2(VADriverContextP ctx, VABufferID buf_id, usage = PIPE_MAP_READ; else usage = PIPE_MAP_WRITE; + + /* Map decoder and postproc surfaces also for reading. */ + if (buf->derived_surface.entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM || + buf->derived_surface.entrypoint == PIPE_VIDEO_ENTRYPOINT_PROCESSING) + usage |= PIPE_MAP_READ; } if (flags & VA_MAPBUFFER_FLAG_READ) diff --git a/src/gallium/frontends/va/image.c b/src/gallium/frontends/va/image.c index d109646d3ff..98d423f2a4d 100644 --- a/src/gallium/frontends/va/image.c +++ b/src/gallium/frontends/va/image.c @@ -435,6 +435,9 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image) pipe_resource_reference(&img_buf->derived_surface.resource, surfaces[0]->texture); img_buf->derived_image_buffer = new_buffer; + if (surf->ctx) + img_buf->derived_surface.entrypoint = surf->ctx->templat.entrypoint; + img->buf = handle_table_add(VL_VA_DRIVER(ctx)->htab, img_buf); mtx_unlock(&drv->mutex); diff --git a/src/gallium/frontends/va/va_private.h b/src/gallium/frontends/va/va_private.h index 5df1bdb6d70..df80a60623c 100644 --- a/src/gallium/frontends/va/va_private.h +++ b/src/gallium/frontends/va/va_private.h @@ -316,6 +316,7 @@ typedef struct { struct { struct pipe_resource *resource; struct pipe_transfer *transfer; + enum pipe_video_entrypoint entrypoint; } derived_surface; unsigned int export_refcount; VABufferInfo export_state;