[vlc-devel] [PATCH 1/5] mmal:vout: don't lock the buffers via the pool anymore

Steve Lhomme robux4 at ycbcr.xyz
Mon Feb 25 15:59:22 CET 2019


Thomas is OK with breaking MMAL and Android for now.

The pools modified for now are used for both decoding and displaying, 
from what I understand.

Given how the lock/unlock currently works it may not be possible to get 
rid of these callbacks entirely. They may be called from multiple 
decoding threads and unlock/locked again for displaying. And they may 
need to be unlocked (not accessible to the CPU) to be used for 
displaying. If the plane pointers change between a lock/unlock it may 
mean the lock/unlock needs to be done every time when the decoder is 
going to use the picture (or when the picture is finished being used by 
the display).

On 25/02/2019 15:49, Steve Lhomme wrote:
> This may not work if subsequent calls to lock didn't give the same buffer
> pointers.
> This pool will probably move in the decoder anyway. The unlock/lock might have
> to be done in the Display() if displaying locked pictures is not possible.
> ---
>   modules/hw/mmal/vout.c | 14 +++++++++-----
>   1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
> index ec16b458ca..73656a0ac1 100644
> --- a/modules/hw/mmal/vout.c
> +++ b/modules/hw/mmal/vout.c
> @@ -455,7 +455,6 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count)
>   {
>       vout_display_sys_t *sys = vd->sys;
>       picture_resource_t picture_res;
> -    picture_pool_configuration_t picture_pool_cfg;
>       MMAL_STATUS_T status;
>       unsigned i;
>   
> @@ -533,14 +532,19 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count)
>   
>           sys->pictures[i]->i_planes = sys->i_planes;
>           memcpy(sys->pictures[i]->p, sys->planes, sys->i_planes * sizeof(plane_t));
> +
> +#if 1 /* do the lock once for now */
> +        mmal_picture_lock(sys->pictures[i]);
> +#endif
>       }
>   
> -    memset(&picture_pool_cfg, 0, sizeof(picture_pool_configuration_t));
> -    picture_pool_cfg.picture_count = sys->num_buffers;
> -    picture_pool_cfg.picture = sys->pictures;
> +#if 0
> +    /* the lock needs to be done before the decoder starts using the memory
> +     * if the memory changes between lock calls it needs to be kept via the pool */
>       picture_pool_cfg.lock = mmal_picture_lock;
> +#endif
>   
> -    sys->picture_pool = picture_pool_NewExtended(&picture_pool_cfg);
> +    sys->picture_pool = picture_pool_New(sys->num_buffers, sys->pictures);
>       if (!sys->picture_pool) {
>           msg_Err(vd, "Failed to create picture pool");
>           goto out;
> -- 
> 2.17.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list