On Wednesday, February 15th, 2023 at 14:41, Pekka Paalanen <ppaalanen@xxxxxxxxx> 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.