From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0065A10E65C for ; Thu, 24 Feb 2022 20:16:50 +0000 (UTC) Date: Thu, 24 Feb 2022 12:16:38 -0800 Message-ID: <87y2209g0p.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Zbigniew =?ISO-8859-2?Q?Kempczy=F1ski?= In-Reply-To: <20220224075415.18663-3-zbigniew.kempczynski@intel.com> References: <20220224075415.18663-1-zbigniew.kempczynski@intel.com> <20220224075415.18663-3-zbigniew.kempczynski@intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable Subject: Re: [igt-dev] [PATCH i-g-t 2/2] tests/api_intel_allocator: Add default-alignment test List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Wed, 23 Feb 2022 23:54:15 -0800, Zbigniew Kempczy=F1ski wrote: > > diff --git a/tests/i915/api_intel_allocator.c b/tests/i915/api_intel_allo= cator.c > index 7ae4a00b7..32d1aad70 100644 > --- a/tests/i915/api_intel_allocator.c > +++ b/tests/i915/api_intel_allocator.c > @@ -120,6 +120,34 @@ static void reserve(int fd, uint8_t type) > igt_assert_eq(intel_allocator_close(ahnd), true); > } > > +static void default_alignment(int fd) > +{ > + struct test_obj obj[3]; > + uint64_t ahnd, default_alignment =3D 0x4000; > + > + ahnd =3D intel_allocator_open_full(fd, 0, 0, 0, INTEL_ALLOCATOR_SIMPLE, > + ALLOC_STRATEGY_LOW_TO_HIGH, > + default_alignment); > + > + for (int i =3D 0; i < ARRAY_SIZE(obj); i++) { > + obj[i].handle =3D gem_handle_gen(); > + obj[i].offset =3D intel_allocator_alloc(ahnd, obj[i].handle, 4096, > + i =3D=3D 2 ? 4096 : 0); > + igt_debug("obj[%d].offset: %llx, handle: %u\n", i, > + (long long) obj[i].offset, obj[i].handle); > + } > + > + igt_assert_eq(obj[1].offset - obj[0].offset, default_alignment); What would happen here if we had not specified default_alignment (i.e. let the allocator choose safe_alignment silently)? Do we need a "get_alignment()" API? Or clients know that the default default_alignment is safe_alignment? In any case, this patch is fine so: Reviewed-by: Ashutosh Dixit