[PATCH] drm: document expectations for GETFB2 handles

Simon Ser contact at emersion.fr
Wed Feb 15 17:03:54 UTC 2023


On Wednesday, February 15th, 2023 at 14:41, Pekka Paalanen <ppaalanen at gmail.com> wrote:

> I didn't know it was at all possible to have different GEM handles
> pointing to the same object. DMABUF import is guaranteed to return the
> existing GEM handle, right? Why is GETFB2 different? Why does it not
> have the same problem as what forced DMABUF import to return existing
> handles?

drm_gem_prime_fd_to_handle() explicitly checks whether the memory object
already has a GEM handle via drm_prime_lookup_buf_handle(). OTOH,
drm_mode_getfb() and drm_mode_getfb2_ioctl() just unconditionally call
drm_gem_handle_create().

Yes, it's a rather inconsistent detail. A detail which becomes very
important when ref'counting and trying not to leak GEM handles from
user-space. Fortunately GETFB/GETFB2 usage is pretty seldom.


More information about the dri-devel mailing list