[igt-dev] [PATCH 2/2] lib/intel_batchbuffer: allow GTT size be not power of 2

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Oct 27 09:04:11 UTC 2023


Hi Andrzej,
On 2023-10-26 at 17:50:30 +0200, Andrzej Hajda wrote:
> GTT size reported by the driver can be shorter than
> the actual size due to possible reserved addresses.
> Rounding it up to power of 2 should give us back
> actual GTT size.
> The patch is prerequisite for upcoming driver changes
> introducing per context batch buffers.
> 
> Signed-off-by: Andrzej Hajda <andrzej.hajda at intel.com>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  lib/intel_batchbuffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> index df82ef5f5ca..c32d04302fe 100644
> --- a/lib/intel_batchbuffer.c
> +++ b/lib/intel_batchbuffer.c
> @@ -1675,7 +1675,7 @@ __intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,
>  			offset = __intel_bb_get_offset(ibb, handle, size,
>  						       alignment);
>  		} else {
> -			offset = offset & (ibb->gtt_size - 1);
> +			offset = offset & (roundup_power_of_two(ibb->gtt_size) - 1);
>  
>  			/*
>  			 * For simple allocator check entry consistency
> 
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list