[vlc-devel] [PATCH 5/5] picture_pool: don't lock/unlock pictures anymore

Rémi Denis-Courmont remi at remlab.net
Mon Feb 25 19:17:07 CET 2019


Le maanantaina 25. helmikuuta 2019, 16.49.07 EET Steve Lhomme a écrit :
> We can no longer use GPU pictures in CPU code via the pools. It has to be
> done explicitly and only if the mapped memory doesn't change during the
> lifetime of the picture.
> ---
>  src/misc/picture_pool.c | 18 ------------------
>  1 file changed, 18 deletions(-)
> 
> diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
> index d6717d2490..a14d944700 100644
> --- a/src/misc/picture_pool.c
> +++ b/src/misc/picture_pool.c
> @@ -39,8 +39,6 @@
>  static_assert ((POOL_MAX & (POOL_MAX - 1)) == 0, "Not a power of two");
> 
>  struct picture_pool_t {
> -    int       (*pic_lock)(picture_t *);
> -    void      (*pic_unlock)(picture_t *);
>      vlc_mutex_t lock;
>      vlc_cond_t  wait;
> 
> @@ -77,8 +75,6 @@ static void picture_pool_ReleasePicture(picture_t *clone)
>      unsigned offset = sys & (POOL_MAX - 1);
>      picture_t *picture = pool->picture[offset];
> 
> -    if (pool->pic_unlock != NULL)
> -        pool->pic_unlock(picture);
>      picture_Release(picture);
> 
>      vlc_mutex_lock(&pool->lock);
> @@ -208,12 +204,6 @@ picture_t *picture_pool_Get(picture_pool_t *pool)
> 
>          picture_t *picture = pool->picture[i];
> 
> -        if (pool->pic_lock != NULL && pool->pic_lock(picture) !=
> VLC_SUCCESS) { -            vlc_mutex_lock(&pool->lock);
> -            pool->available |= 1ULL << i;
> -            continue;
> -        }
> -

The containing while() should be replaced by an if() as well.

>          picture_t *clone = picture_pool_ClonePicture(pool, i);
>          if (clone != NULL) {
>              assert(clone->p_next == NULL);
> @@ -247,14 +237,6 @@ picture_t *picture_pool_Wait(picture_pool_t *pool)
> 
>      picture_t *picture = pool->picture[i];
> 
> -    if (pool->pic_lock != NULL && pool->pic_lock(picture) != VLC_SUCCESS) {
> -        vlc_mutex_lock(&pool->lock);
> -        pool->available |= 1ULL << i;
> -        vlc_cond_signal(&pool->wait);
> -        vlc_mutex_unlock(&pool->lock);
> -        return NULL;
> -    }
> -
>      picture_t *clone = picture_pool_ClonePicture(pool, i);
>      if (clone != NULL) {
>          assert(clone->p_next == NULL);


-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list