[Mesa-dev] [PATCH 11/53] i965/drm: Switch to util/list.h instead of libdrm_lists.h.

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 5 09:58:31 UTC 2017


On Tue, Apr 04, 2017 at 05:10:01PM -0700, Kenneth Graunke wrote:
> Both are kernel style lists, so this is trivial.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> @@ -1928,10 +1928,10 @@ drm_bacon_bufmgr_gem_destroy(drm_bacon_bufmgr *bufmgr)
>  		    &bufmgr_gem->cache_bucket[i];
>  		drm_bacon_bo_gem *bo_gem;
>  
> -		while (!DRMLISTEMPTY(&bucket->head)) {
> -			bo_gem = DRMLISTENTRY(drm_bacon_bo_gem,
> -					      bucket->head.next, head);
> -			DRMLISTDEL(&bo_gem->head);
> +		while (!list_empty(&bucket->head)) {
> +			bo_gem = LIST_ENTRY(drm_bacon_bo_gem,
> +					    bucket->head.next, head);
> +			list_del(&bo_gem->head);

Does mesa have list_for_each_safe? Future improvement if this code
remains. If!

>  			drm_bacon_gem_bo_free(&bo_gem->bo);
>  		}
> @@ -2668,7 +2668,7 @@ drm_bacon_bo_gem_create_from_prime(drm_bacon_bufmgr *bufmgr, int prime_fd, int s
>  		goto out;
>  
>  	p_atomic_set(&bo_gem->refcount, 1);
> -	DRMINITLISTHEAD(&bo_gem->vma_list);
> +	list_inithead(&bo_gem->vma_list);
>  
>  	/* Determine size of bo.  The fd-to-handle ioctl really should
>  	 * return the size, but it doesn't.  If we have kernel 3.12 or
> @@ -3084,7 +3084,7 @@ add_bucket(drm_bacon_bufmgr_gem *bufmgr_gem, int size)
>  
>  	assert(i < ARRAY_SIZE(bufmgr_gem->cache_bucket));
>  
> -	DRMINITLISTHEAD(&bufmgr_gem->cache_bucket[i].head);
> +	list_inithead(&bufmgr_gem->cache_bucket[i].head);
>  	bufmgr_gem->cache_bucket[i].size = size;
>  	bufmgr_gem->num_buckets++;
>  }
> @@ -3369,14 +3369,13 @@ drm_bacon_get_min_eu_in_pool(int fd)
>  }
>  
>  static pthread_mutex_t bufmgr_list_mutex = PTHREAD_MUTEX_INITIALIZER;
> -static drmMMListHead bufmgr_list = { &bufmgr_list, &bufmgr_list };
> +static struct list_head bufmgr_list = { &bufmgr_list, &bufmgr_list };

A missing opportunity for static LIST_HEAD(bufmgr_list)?

Looks mechanical as expected,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the mesa-dev mailing list