[Mesa-dev] [PATCH 4/5] Tidy a bit compute_memory_finalize_pending

Tom Stellard tom at stellard.net
Sat Jan 4 08:52:24 PST 2014


On Sat, Jan 04, 2014 at 01:27:32AM +0100, Bruno Jiménez wrote:
> ---
>  src/gallium/drivers/r600/compute_memory_pool.c | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
> index 5374a48..954c890 100644
> --- a/src/gallium/drivers/r600/compute_memory_pool.c
> +++ b/src/gallium/drivers/r600/compute_memory_pool.c
> @@ -320,21 +320,17 @@ int compute_memory_finalize_pending(struct compute_memory_pool* pool,
>  			int64_t need = item->size_in_dw+2048 -
>  						(pool->size_in_dw - allocated);
>  
> -			need += 1024 - (need % 1024);
>  
> -			if (need > 0) {
> -				err = compute_memory_grow_pool(pool,
> -						pipe,
> -						pool->size_in_dw + need);
> -			}
> -			else {
> +			if (need <= 0) {

It looks like we are changing the behavior of the code here,
because we are no longer doing need += 1024 - (need % 1024) before
checking the value of need.

This code really does need to be cleaned up, but I want to make sure we
aren't changing its behavior, or if we are we have a test case to show
we aren't breaking things.

If you don't think we are changing behavior here, can you explain why
not?

Thanks,
Tom
>  				need = pool->size_in_dw / 10;
> -				need += 1024 - (need % 1024);
> -				err = compute_memory_grow_pool(pool,
> -						pipe,
> -						pool->size_in_dw + need);
>  			}
>  
> +			need += 1024 - (need % 1024);
> +
> +			err = compute_memory_grow_pool(pool,
> +					pipe,
> +					pool->size_in_dw + need);
> +
>  			if(err == -1)
>  				return -1;
>  		}
> -- 
> 1.8.5.2
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list