Should multiple PRIME_FD_TO_HANDLE ioctls on the same fd require multiple GEM_CLOSE?

John Cox jc at kynesim.co.uk
Tue Oct 12 13:42:11 UTC 2021


Hi

I've a question about expected behavior. I am using the "vc4" backend.

If I convert a dmabuf fd to a bo handle twice using
DRM_IOCTL_PRIME_FD_TO_HANDLE then I get the same bo handle both times -
fair enough.

If I then close it twice with DRM_IOCTL_GEM_CLOSE then the second time
fails.

Is this expected behavior?  I think I would have hoped that the
PRIME_FD_TO_HANDLE ops would have incremented a ref count on the object
and it would need to be CLOSED as many times as it was "opened"
otherwise one bit of code can accidentally close a bo handle that was in
use in another.

Many thanks

John Cox


More information about the dri-devel mailing list