[igt-dev] [PATCH i-g-t v3 02/52] lib/intel_allocator: Add few helper functions for common use

Dixit, Ashutosh ashutosh.dixit at intel.com
Wed Aug 4 00:18:32 UTC 2021


On Tue, 03 Aug 2021 14:01:24 -0700, Dixit, Ashutosh wrote:
>
> On Mon, 26 Jul 2021 12:59:36 -0700, Zbigniew Kempczyński wrote:
> >
> > +static inline uint64_t get_simple_ahnd(int fd, uint32_t ctx)
> > +{
> > +	bool do_relocs = gem_has_relocations(fd);
> > +
> > +	return do_relocs ? 0 : intel_allocator_open(fd, ctx, INTEL_ALLOCATOR_SIMPLE);
>
> Should this function be e.g.
>
>     return intel_allocator_open(fd, 0, do_relocs ?
>                                 INTEL_ALLOCATOR_RELOC : INTEL_ALLOCATOR_SIMPLE);
>
> Similarly for others.

The patch is fine but there was the above code (which I wrote) in
gem_linear_blits.c, hence I was wondering.

> +static inline uint64_t get_offset(uint64_t ahnd, uint32_t handle,
> +				  uint64_t size, uint64_t alignment)
> +{
> +	if (!ahnd)
> +		return 0;
> +
> +	return intel_allocator_alloc(ahnd, handle, size, alignment);
> +}
> +
> +static inline bool put_offset(uint64_t ahnd, uint32_t handle)
> +{
> +	if (!ahnd)
> +		return 0;
> +
> +	return intel_allocator_free(ahnd, handle);
> +}
> +

Also for the function names are too generic with potential for namespace
conflicts, probably ahnd_get_offset/ahnd_put_offset?

In any case, this is:

Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>


More information about the igt-dev mailing list