[Mesa-dev] [PATCH v2 7/9] anv/allocator: Add a syncobj cache

Jason Ekstrand jason at jlekstrand.net
Fri Aug 4 16:29:40 UTC 2017


On Fri, Aug 4, 2017 at 1:59 AM, Chris Wilson <chris at chris-wilson.co.uk>
wrote:

> Quoting Jason Ekstrand (2017-08-04 02:25:26)
> > This is mostly a copy+paste of the BO cache but it's a bit simpler
> > because syncobjs don't have actual backing storage so we don't need to
> > check sizes or anything like that.  Also, we put the refcount directly
> > in anv_syncobj because they will always be heap pointers.
>
> Ok, but why do we need one at all? Some part of the Vk spec, some bad
> behaviour you noticed? Or just that it is more elegant to be minimalist?
>

Gah!  I thought I saw a real-world problem and decided the kernel must be
de-duplicating for me.  But now I remember that it doesn't and just looked
at the kernel code and confirmed that it gives you a new idr entry on every
fd_to_handle.  I'll delete all this garbage and go back to doing it the way
I was before.  Thanks for pointing that out!


> > ---
> >  src/intel/vulkan/anv_allocator.c | 194 ++++++++++++++++++++++++++++++
> +++++++++
> >  src/intel/vulkan/anv_device.c    |   9 +-
> >  src/intel/vulkan/anv_private.h   |  40 ++++++++
> >  3 files changed, 242 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_
> allocator.c
> > index efaaebc..204c466 100644
> > --- a/src/intel/vulkan/anv_allocator.c
> > +++ b/src/intel/vulkan/anv_allocator.c
> > @@ -1422,3 +1422,197 @@ anv_bo_cache_release(struct anv_device *device,
> >
> >     vk_free(&device->alloc, bo);
> >  }
> > +
> > +VkResult
> > +anv_syncobj_cache_init(struct anv_syncobj_cache *cache)
> > +{
> > +   cache->map = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
> > +                                        _mesa_key_pointer_equal);
>
> Not hash_uint for u32? Bah, for the number of ht mesa creates for
> looking up u32 names, you would think it would have an ultra-specialised
> data struct for it. :(
> -Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170804/c72787fc/attachment.html>


More information about the mesa-dev mailing list