[Mesa-dev] [PATCH 15/19] pipebuffer, winsys: Add a size match parameter to the cached buffer manager

Brian Paul brianp at vmware.com
Fri Feb 14 06:47:01 PST 2014


Sure.  If you don't mind, I'll just do that as a follow-on patch...

-Brian

On 02/13/2014 07:11 PM, Marek Olšák wrote:
> Please, can the size factor be a float?
>
> Thanks,
>
> Marek
>
> On Fri, Feb 14, 2014 at 2:21 AM, Brian Paul <brianp at vmware.com> wrote:
>> From: Thomas Hellstrom <thellstrom at vmware.com>
>>
>> In some situations it's important to restrict the sizes of buffers that the
>> cached buffer manager is allowed to return
>>
>> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
>> Cc: "10.1" <mesa-stable at lists.freedesktop.org>
>> ---
>>   src/gallium/auxiliary/pipebuffer/pb_bufmgr.h       |    3 ++-
>>   src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c |    7 +++++--
>>   src/gallium/winsys/radeon/drm/radeon_drm_winsys.c  |    2 +-
>>   3 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
>> index 2c88cf4..fe4c8c2 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
>> @@ -161,7 +161,8 @@ pb_slab_range_manager_create(struct pb_manager *provider,
>>    */
>>   struct pb_manager *
>>   pb_cache_manager_create(struct pb_manager *provider,
>> -                       unsigned usecs);
>> +                       unsigned usecs,
>> +                       unsigned size_factor);
>>
>>
>>   struct pb_fence_ops;
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
>> index 9728bf4..6de5de0 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
>> @@ -82,6 +82,7 @@ struct pb_cache_manager
>>
>>      struct list_head delayed;
>>      pb_size numDelayed;
>> +   unsigned size_factor;
>>   };
>>
>>
>> @@ -231,7 +232,7 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
>>         return 0;
>>
>>      /* be lenient with size */
>> -   if(buf->base.size >= 2*size)
>> +   if(buf->base.size > buf->mgr->size_factor*size)
>>         return 0;
>>
>>      if(!pb_check_alignment(desc->alignment, buf->base.alignment))
>> @@ -387,7 +388,8 @@ pb_cache_manager_destroy(struct pb_manager *mgr)
>>
>>   struct pb_manager *
>>   pb_cache_manager_create(struct pb_manager *provider,
>> -                       unsigned usecs)
>> +                       unsigned usecs,
>> +                       unsigned size_factor)
>>   {
>>      struct pb_cache_manager *mgr;
>>
>> @@ -403,6 +405,7 @@ pb_cache_manager_create(struct pb_manager *provider,
>>      mgr->base.flush = pb_cache_manager_flush;
>>      mgr->provider = provider;
>>      mgr->usecs = usecs;
>> +   mgr->size_factor = size_factor;
>>      LIST_INITHEAD(&mgr->delayed);
>>      mgr->numDelayed = 0;
>>      pipe_mutex_init(mgr->mutex);
>> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>> index c28f3a7..b7137d2 100644
>> --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
>> @@ -645,7 +645,7 @@ PUBLIC struct radeon_winsys *radeon_drm_winsys_create(int fd)
>>       ws->kman = radeon_bomgr_create(ws);
>>       if (!ws->kman)
>>           goto fail;
>> -    ws->cman = pb_cache_manager_create(ws->kman, 1000000);
>> +    ws->cman = pb_cache_manager_create(ws->kman, 1000000, 2);
>>       if (!ws->cman)
>>           goto fail;
>>
>> --
>> 1.7.10.4
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=MlqYvKJO61Ep3bXn6Rg70XwXP9IBmzJWweG4uycHW%2Bw%3D%0A&s=eaa0cec3a9d68bbb2d845d10dc79dd7893b08b75d38288915655d46a9e1e245d
>



More information about the mesa-dev mailing list