[Mesa-dev] [PATCH 1/3] panfrost: Cache BO imports

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Fri Jul 5 13:35:06 UTC 2019


>  struct panfrost_bo {
> -        struct pipe_reference reference;
> +        int refcnt;
>  
>          /* Mapping for the entire object (all levels) */

Why are we open-coding this instead of using pipe_reference?

> +        pthread_mutex_lock(&screen->handle_table_lock);
> +        _mesa_hash_table_insert(screen->handle_table, &bo->gem_handle, bo);
> +        pthread_mutex_unlock(&screen->handle_table_lock);

Use the u64 hash table variants.

>  
> +static uint32_t
> +u32_hash(const void *key)
> +{
> +        return _mesa_hash_data(key, sizeof(uint32_t));
> +}
> +
> +static bool
> +u32_equals(const void *key1, const void *key2)
> +{
> +        return *(const uint32_t *)key1 == *(const uint32_t *)key2;
> +}

Again, use the u64 hash table variants and all of this goes away.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190705/2ccee0a7/attachment.sig>


More information about the mesa-dev mailing list