[igt-dev] [PATCH i-g-t 3/4] tests/i915/api_intel_allocator: Fixed start offset

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Dec 19 07:58:14 UTC 2022


On Wed, Dec 14, 2022 at 08:29:43AM +0100, Dominik Karol Piatkowski wrote:
> On some platforms it may be required to use safe start offset
> instead of hardcoded one.
> 
> Signed-off-by: Dominik Karol Piatkowski <dominik.karol.piatkowski at intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> ---
>  tests/i915/api_intel_allocator.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/i915/api_intel_allocator.c b/tests/i915/api_intel_allocator.c
> index 87abd900..cf401176 100644
> --- a/tests/i915/api_intel_allocator.c
> +++ b/tests/i915/api_intel_allocator.c
> @@ -96,7 +96,7 @@ static void reserve_simple(int fd)
>  static void reserve(int fd, uint8_t type)
>  {
>  	struct test_obj obj;
> -	uint64_t ahnd, offset = 0x40000, size = 0x1000;
> +	uint64_t ahnd, offset = gem_detect_safe_start_offset(fd), size = 0x1000;

Isn't better would be to use intel_allocator_get_address_range() here?
Above will work because we're not executing anything, but I still see
mismatch between offset and allocator start offset which will be aligned
to safe alignment (patches 1/4 and 2/4). Start offset detected here may
be less than aligned start established during intel_allocator_open().

--
Zbigniew

>  
>  	ahnd = intel_allocator_open(fd, 0, type);
>  
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list