[RFC PATCH] drm/syncobj: add IOCTL to register an eventfd for a timeline

Pekka Paalanen ppaalanen at gmail.com
Mon Oct 10 08:19:34 UTC 2022


On Sun, 09 Oct 2022 14:40:14 +0000
Simon Ser <contact at emersion.fr> wrote:

> Introduce a new DRM_IOCTL_SYNCOBJ_TIMELINE_REGISTER_EVENTFD IOCTL
> which signals an eventfd when a timeline point completes.
> 
> This is useful for Wayland compositors to handle wait-before-submit.
> Wayland clients can send a timeline point to the compositor
> before the point has materialized yet, then compositors can wait
> for the point to materialize via this new IOCTL.
> 
> The existing DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT IOCTL is not suitable
> because it blocks. Compositors want to integrate the wait with
> their poll(2)-based event loop.
> 
> Signed-off-by: Simon Ser <contact at emersion.fr>
> Cc: Jason Ekstrand <jason at jlekstrand.net>
> Cc: Daniel Vetter <daniel at ffwll.ch>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> Cc: Daniel Stone <daniel at fooishbar.org>
> Cc: Pekka Paalanen <ppaalanen at gmail.com>
> Cc: James Jones <jajones at nvidia.com>
> ---
>  drivers/gpu/drm/drm_internal.h |   3 +
>  drivers/gpu/drm/drm_ioctl.c    |   3 +
>  drivers/gpu/drm/drm_syncobj.c  | 113 +++++++++++++++++++++++++++++++--
>  include/drm/drm_syncobj.h      |   6 +-
>  include/uapi/drm/drm.h         |  15 +++++
>  5 files changed, 133 insertions(+), 7 deletions(-)

...

> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index 642808520d92..359e21414196 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -909,6 +909,20 @@ struct drm_syncobj_timeline_wait {
>  	__u32 pad;
>  };
>  

Hi,

I'm completely clueless about this API.

> +/**
> + * struct drm_syncobj_timeline_register_eventfd
> + *
> + * Register an eventfd to be signalled when a timeline point completes. The
> + * eventfd counter will be incremented by one.

Sounds nice.

Since the action is to increment the counter by one, does it mean it
will be possible to wait for a bunch of completions and have the
eventfd poll return only when they have all signaled?

> + */
> +struct drm_syncobj_timeline_register_eventfd {
> +	__u32 handle;

Handle of what?

> +	__u32 flags;

What flags are allowed? Must be zero for now?

> +	__u64 point;

Is this some Vulkan thingy?

> +	__s32 fd;

I guess the userspace needs to create an eventfd first, and pass it as
the argument here? This is not creating a new eventfd itself?

> +	__u32 pad;

Must be zero?


Thanks,
pq

> +};
> +
>  
>  struct drm_syncobj_array {
>  	__u64 handles;
> @@ -1095,6 +1109,7 @@ extern "C" {
>  #define DRM_IOCTL_SYNCOBJ_QUERY		DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
>  #define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct drm_syncobj_transfer)
>  #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL	DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
> +#define DRM_IOCTL_SYNCOBJ_TIMELINE_REGISTER_EVENTFD	DRM_IOWR(0xCE, struct drm_syncobj_timeline_register_eventfd)
>  
>  /**
>   * DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20221010/c9602964/attachment.sig>


More information about the wayland-devel mailing list