[Mesa-dev] [PATCH 11/53] i965/drm: Switch to util/list.h instead of libdrm_lists.h.
Kenneth Graunke
kenneth at whitecape.org
Wed Apr 5 21:17:31 UTC 2017
On Wednesday, April 5, 2017 2:58:31 AM PDT Chris Wilson wrote:
> 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!
Sounds good, we can do:
list_for_each_entry_safe(struct brw_bo, bo, &bucket->head, head) {
I found three places where we can do that.
> > 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)?
Hrm, I don't see a LIST_HEAD in our list. The code dies in patch 33
anyway, so I'll just leave it be.
> Looks mechanical as expected,
> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> -Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170405/84fd924f/attachment.sig>
More information about the mesa-dev
mailing list