[igt-dev] [PATCH i-g-t v31 13/32] lib/igt_fb: Removal of libdrm dependency

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 26 16:11:28 UTC 2020


Quoting Chris Wilson (2020-08-26 17:09:06)
> Quoting Zbigniew Kempczyński (2020-08-20 07:30:11)
> > +       bo_name = gem_flink(blit->fd, fb->gem_handle);
> > +       handle = gem_open(blit->fd, bo_name);
> > +       buf = calloc(1, sizeof(*buf));
> > +       igt_assert(buf);
> > +       intel_buf_init_using_handle(blit->bops, handle, buf, fb->width,
> > +                                   fb->height, fb->plane_bpp[0], 0,
> > +                                   igt_fb_mod_to_tiling(fb->modifier),
> > +                                   compression);
> > +       intel_buf_set_name(buf, name);
> 
> I'd wrap this into a local buf_create_for_handle routine. Which does beg
> the question where are we creating a new handle if we already have a
> gem_handle? Lifetime worries? That's not explained...
> 
> I'd guess lifetime. In which case that would be an internal detail of
> intel_buf leaking through, and I would suggest pushing the routine into
> the library if it takes ownership of the handle.

To be clear, it's not immediately obvious to me that
intel_buf_init_using_handle() takes ownership. My experience would be a
routine that acknowledges it is using an external resource would be not
to destroy that resource on cleanup.
-Chris


More information about the igt-dev mailing list