[Mesa-dev] [PATCH 16/20] st/va: relocate surface when stack field false

Christian König deathsimple at vodafone.de
Wed Aug 16 07:26:38 UTC 2017


Am 15.08.2017 um 22:08 schrieb Leo Liu:
> Signed-off-by: Leo Liu <leo.liu at amd.com>

The subject line should probably read "reallocate" instead of "relocate".

Additional to that the term "stacked field" isn't really used outside 
AMD, better use interlaced layout.

Apart from that the patch looks good to me as well.

Christian.

> ---
>   src/gallium/state_trackers/va/picture.c | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
>
> diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
> index 59594829dd..3af387ea5b 100644
> --- a/src/gallium/state_trackers/va/picture.c
> +++ b/src/gallium/state_trackers/va/picture.c
> @@ -589,6 +589,8 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
>      vlVaBuffer *coded_buf;
>      vlVaSurface *surf;
>      void *feedback;
> +   struct pipe_screen *screen;
> +   bool interlaced;
>   
>      if (!ctx)
>         return VA_STATUS_ERROR_INVALID_CONTEXT;
> @@ -615,6 +617,26 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
>      surf = handle_table_get(drv->htab, context->target_id);
>      context->mpeg4.frame_num++;
>   
> +   screen = context->decoder->context->screen;
> +   interlaced = screen->get_video_param(screen, context->decoder->profile,
> +                                        PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
> +                                        PIPE_VIDEO_CAP_SUPPORTS_INTERLACED);
> +
> +   if (surf->buffer->interlaced != interlaced) {
> +      surf->templat.interlaced = screen->get_video_param(screen, context->decoder->profile,
> +                                                         PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
> +                                                         PIPE_VIDEO_CAP_PREFERS_INTERLACED);
> +
> +      surf->buffer->destroy(surf->buffer);
> +
> +      if (vlVaHandleSurfaceAllocate(ctx, surf, &surf->templat) != VA_STATUS_SUCCESS) {
> +         mtx_unlock(&drv->mutex);
> +         return VA_STATUS_ERROR_ALLOCATION_FAILED;
> +      }
> +
> +      context->target = surf->buffer;
> +   }
> +
>      if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
>         coded_buf = context->coded_buf;
>         getEncParamPreset(context);




More information about the mesa-dev mailing list