[Mesa-dev] [PATCH 4/4] st/omx/dec: make decoder video buffer progressive

Emil Velikov emil.l.velikov at gmail.com
Thu Jul 7 15:39:51 UTC 2016


On 6 July 2016 at 19:03, Leo Liu <leo.liu at amd.com> wrote:
> The idea of encode tunneling is to use video buffer directly for encoder,
> but currently the encoder doesn’t support interlaced surface, the OMX
> decoder set progressive surface before on that purpose.
>
> Since now we are polling the driver for interlacing information for
> decoder, we got the interlaced as preferred as other APIs(VDPAU, VA-API),
> thus breaking the transcode with tunneling.
>
> The solution is when with tunnel detected, re-allocate progressive target
> buffers, and then converting the interlaced decoder results to there.
>
> This has been tested with transcode results bit to bit matching as before
> with surface from progressive to progressive.
>
> Signed-off-by: Leo Liu <leo.liu at amd.com>
> ---
>  src/gallium/state_trackers/omx/vid_dec.c | 65 +++++++++++++++++++++++++++++++-
>  src/gallium/state_trackers/omx/vid_dec.h |  6 ++-
>  2 files changed, 68 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/state_trackers/omx/vid_dec.c b/src/gallium/state_trackers/omx/vid_dec.c
> index a989c10..7842966 100644
> --- a/src/gallium/state_trackers/omx/vid_dec.c
> +++ b/src/gallium/state_trackers/omx/vid_dec.c
> @@ -167,6 +167,19 @@ static OMX_ERRORTYPE vid_dec_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
>     if (!priv->pipe)
>        return OMX_ErrorInsufficientResources;
>
> +   if (!vl_compositor_init(&priv->compositor, priv->pipe)) {
> +      priv->pipe->destroy(priv->pipe);
> +      priv->pipe = NULL;
> +      return OMX_ErrorInsufficientResources;
> +   }
> +
> +   if (!vl_compositor_init_state(&priv->cstate, priv->pipe)) {
> +      vl_compositor_cleanup(&priv->compositor);
> +      priv->pipe->destroy(priv->pipe);
> +      priv->pipe = NULL;
> +      return OMX_ErrorInsufficientResources;
> +   }
> +()
IIRC as vid_dec_Constructor() fails, the caller (bellagio?) explicitly
calls the destructor vid_dec_Destructor(). Thus the above teardown
should not be needed.

>     priv->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0;
>     priv->sPortTypesParam[OMX_PortDomainVideo].nPorts = 2;
>     priv->ports = CALLOC(2, sizeof(omx_base_PortType *));
> @@ -218,8 +231,11 @@ static OMX_ERRORTYPE vid_dec_Destructor(OMX_COMPONENTTYPE *comp)
>        priv->ports=NULL;
>     }
>
> -   if (priv->pipe)
> +   if (priv->pipe) {
> +      vl_compositor_cleanup_state(&priv->cstate);
> +      vl_compositor_cleanup(&priv->compositor);
Neither vl_compositor_cleanup_state() nor vl_compositor_cleanup() is
happy if upon deref. the value (pointer again) is NULL.

omx/vid_enc.c could use similar cleanups ?

Thanks,
Emil


More information about the mesa-dev mailing list