All of lore.kernel.org
 help / color / mirror / Atom feed
* Should multiple PRIME_FD_TO_HANDLE ioctls on the same fd require multiple GEM_CLOSE?
@ 2021-10-12 13:42 John Cox
  2021-10-12 17:33 ` Simon Ser
  0 siblings, 1 reply; 4+ messages in thread
From: John Cox @ 2021-10-12 13:42 UTC (permalink / raw)
  To: dri-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Should multiple PRIME_FD_TO_HANDLE ioctls on the same fd require multiple GEM_CLOSE?
  2021-10-12 13:42 Should multiple PRIME_FD_TO_HANDLE ioctls on the same fd require multiple GEM_CLOSE? John Cox
@ 2021-10-12 17:33 ` Simon Ser
  2021-10-12 18:37   ` John Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Ser @ 2021-10-12 17:33 UTC (permalink / raw)
  To: John Cox; +Cc: dri-devel

Yes, this is expected behavior, even if it's not intuitive. For more
details, see:

https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Should multiple PRIME_FD_TO_HANDLE ioctls on the same fd require multiple GEM_CLOSE?
  2021-10-12 17:33 ` Simon Ser
@ 2021-10-12 18:37   ` John Cox
  2021-10-13 13:28     ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: John Cox @ 2021-10-12 18:37 UTC (permalink / raw)
  To: Simon Ser; +Cc: dri-devel

On Tue, 12 Oct 2021 17:33:18 +0000, you wrote:

>Yes, this is expected behavior, even if it's not intuitive. For more
>details, see:
>
>https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110

Thanks - as noted in that discussion the behaviour is a bit unhelpful
but just knowing that it is expected means I can deal with it.

JC

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Should multiple PRIME_FD_TO_HANDLE ioctls on the same fd require multiple GEM_CLOSE?
  2021-10-12 18:37   ` John Cox
@ 2021-10-13 13:28     ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2021-10-13 13:28 UTC (permalink / raw)
  To: John Cox; +Cc: Simon Ser, dri-devel

On Tue, Oct 12, 2021 at 07:37:11PM +0100, John Cox wrote:
> On Tue, 12 Oct 2021 17:33:18 +0000, you wrote:
> 
> >Yes, this is expected behavior, even if it's not intuitive. For more
> >details, see:
> >
> >https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110
> 
> Thanks - as noted in that discussion the behaviour is a bit unhelpful
> but just knowing that it is expected means I can deal with it.

kerneldoc in that uapi header to explain precisely what and why is going
on would be good too.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-13 13:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 13:42 Should multiple PRIME_FD_TO_HANDLE ioctls on the same fd require multiple GEM_CLOSE? John Cox
2021-10-12 17:33 ` Simon Ser
2021-10-12 18:37   ` John Cox
2021-10-13 13:28     ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.