[Mesa-dev] [PATCH] st/va: move YUV content to deinterlaced buffer when reallocated for encoder

Andy Furniss adf.lists at gmail.com
Fri Aug 25 16:42:21 UTC 2017


Leo Liu wrote:
> v2: use deinterlace common function
> v3: make sure deinterlace only

Doesn't apply to master with git.

patch was less fussy

patch -p 1  < ~/Leo-va-interl-patches/02-3
patching file src/gallium/state_trackers/va/picture.c
Hunk #1 succeeded at 619 with fuzz 1 (offset 6 lines).
Hunk #2 succeeded at 662 (offset 17 lines).

> Signed-off-by: Leo Liu <leo.liu at amd.com>
> ---
>   src/gallium/state_trackers/va/picture.c | 22 ++++++++++++++++------
>   1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
> index 6c3c4fe..aa4062d 100644
> --- a/src/gallium/state_trackers/va/picture.c
> +++ b/src/gallium/state_trackers/va/picture.c
> @@ -613,17 +613,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
>      mtx_lock(&drv->mutex);
>      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,
>                                           context->decoder->entrypoint,
>                                           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);
> -      realloc = true;
> +      interlaced = screen->get_video_param(screen, context->decoder->profile,
> +                                           context->decoder->entrypoint,
> +                                           PIPE_VIDEO_CAP_PREFERS_INTERLACED);
> +      if (!interlaced) {
> +         /* The current cases for buffer reallocation are
> +            all from the interlaced to the deinterlaced,
> +            and there is no case for the other way around */
> +         surf->templat.interlaced = false;
> +         realloc = true;
> +      }
>      }
>   
>      if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG &&
> @@ -640,13 +645,18 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
>      }
>   
>      if (realloc) {
> -      surf->buffer->destroy(surf->buffer);
> +      struct pipe_video_buffer *old_buf = surf->buffer;
>   
>         if (vlVaHandleSurfaceAllocate(ctx, surf, &surf->templat) != VA_STATUS_SUCCESS) {
> +         old_buf->destroy(old_buf);
>            mtx_unlock(&drv->mutex);
>            return VA_STATUS_ERROR_ALLOCATION_FAILED;
>         }
>   
> +      if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE)
> +         vl_compositor_yuv_deint(&drv->cstate, &drv->compositor, old_buf, surf->buffer);
> +
> +      old_buf->destroy(old_buf);
>         context->target = surf->buffer;
>      }
>   
> 



More information about the mesa-dev mailing list