[igt-dev] [PATCH i-g-t v14 07/33] lib/intel_allocator: Add intel_allocator core

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 14 16:15:39 UTC 2021


Quoting Zbigniew Kempczyński (2021-01-14 12:22:07)
> +static struct intel_allocator *allocator_open(int fd, uint32_t ctx,
> +                                             uint8_t allocator_type)
> +{
> +       struct intel_allocator *ial;
> +
> +       pthread_mutex_lock(&map_mutex);
> +
> +       ial = __allocator_get(fd, ctx);
> +       if (ial) {
> +               if (ial->type != allocator_type)
> +                       pthread_mutex_unlock(&map_mutex);
> +               igt_assert_f(ial->type == allocator_type,
> +                            "Allocator must be same type for fd/ctx\n");
> +       } else {
> +               alloc_debug("Allocator fd: %d, ctx: %u not found, creating one\n",
> +                           fd, ctx);
> +               ial = intel_allocator_create(fd, ctx, allocator_type);
> +       }
> +
> +       pthread_mutex_unlock(&map_mutex);

       pthread_mutex_lock(&map_mutex);
       ial = __allocator_get(fd, ctx);
       if (!ial) {
               alloc_debug("Allocator fd: %d, ctx: %u not found, creating one\n",
                           fd, ctx);
               ial = intel_allocator_create(fd, ctx, allocator_type);
       }
       pthread_mutex_unlock(&map_mutex);
       igt_assert_f(ial->type == allocator_type,
		    "Allocator must be same type for fd/ctx\n");


More information about the igt-dev mailing list