[Mesa-dev] [PATCH 1/3] i965: Rename brw_upload_item_data to brw_alloc_item_data

Kenneth Graunke kenneth at whitecape.org
Wed Aug 12 23:19:29 PDT 2015


On Thursday, June 25, 2015 03:45:36 PM Topi Pohjolainen wrote:
> and simplify the interface to take directly the size and to return
> the offset. The routine does nothing more than allocate, it doesn't
> upload anything.
> 
> CC: Kenneth Graunke <kenneth at whitecape.org>
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_state_cache.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
> index 157b33d..97a41b9 100644
> --- a/src/mesa/drivers/dri/i965/brw_state_cache.c
> +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
> @@ -248,18 +248,17 @@ brw_try_upload_using_copy(struct brw_cache *cache,
>     return false;
>  }
>  
> -static void
> -brw_upload_item_data(struct brw_cache *cache,
> -		     struct brw_cache_item *item,
> -		     const void *data)
> +static uint32_t
> +brw_alloc_item_data(struct brw_cache *cache, uint32_t size)
>  {
> +   uint32_t offset;
>     struct brw_context *brw = cache->brw;
>  
>     /* Allocate space in the cache BO for our new program. */
> -   if (cache->next_offset + item->size > cache->bo->size) {
> +   if (cache->next_offset + size > cache->bo->size) {
>        uint32_t new_size = cache->bo->size * 2;
>  
> -      while (cache->next_offset + item->size > new_size)
> +      while (cache->next_offset + size > new_size)
>  	 new_size *= 2;
>  
>        brw_cache_new_bo(cache, new_size);
> @@ -273,10 +272,12 @@ brw_upload_item_data(struct brw_cache *cache,
>        brw_cache_new_bo(cache, cache->bo->size);
>     }
>  
> -   item->offset = cache->next_offset;
> +   offset = cache->next_offset;
>  
>     /* Programs are always 64-byte aligned, so set up the next one now */
> -   cache->next_offset = ALIGN(item->offset + item->size, 64);
> +   cache->next_offset = ALIGN(offset + size, 64);
> +
> +   return offset;
>  }
>  
>  void
> @@ -312,7 +313,7 @@ brw_upload_cache(struct brw_cache *cache,
>      * compile to the thing in our backend.
>      */
>     if (!brw_try_upload_using_copy(cache, item, data, aux)) {
> -      brw_upload_item_data(cache, item, data);
> +      item->offset = brw_alloc_item_data(cache, data_size);
>     }
>  
>     /* Set up the memory containing the key and aux_data */
> 

These three patches are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

I believe Eric's optimization to avoid flagging BRW_NEW_FS_PROG_DATA did
take effect at one point in the past...but I really can't see how it
would now.  A lot has changed since then.

We may want to look into reimplementing that optimization - it's
probably still valuable.  But let's go with this and simplify for now;
we can rebuild it right later.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150812/9d406704/attachment.sig>


More information about the mesa-dev mailing list