mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
frontends/va: Map decoder and postproc surfaces for reading
If application requests to map surface that was most recently used as decoder or postproc target and also doesn't explicitly set the map flags (vaMapBuffer2) it's very likely the intent is to read from this surface, so we need to map it as such. This fixes regression on radeonsi where mapping NV12 surfaces for reading would fail with applications using vaDeriveImage. The reason for this is that the VA frontend doesn't allow vaDeriveImage for interlaced surfaces so the applications would use vaGetImage fallback, but radeonsi doesn't allocate NV12 surfaces as interlaced anymore. This also fixes mapping other formats surfaces (P010, RGBx, ...) for reading, which never worked before. Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9935 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10048 Reviewed-by: Leo Liu <leo.liu@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26008>
This commit is contained in:
parent
33de58154f
commit
c638e61ef5
3 changed files with 9 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue