All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH libdrm 1/2] drm/amdgpu: add syncobj create/destroy/import/export apis
Date: Tue, 18 Jul 2017 10:48:32 +0800	[thread overview]
Message-ID: <596D7700.9000102@amd.com> (raw)
In-Reply-To: <20170718004832.21206-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>



On 2017年07月18日 08:48, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> These are just wrappers using the amdgpu device handle.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
Acked-by: Chunming Zhou <david1.zhou@amd.com>
> ---
>   amdgpu/amdgpu.h    | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
>   amdgpu/amdgpu_cs.c | 38 +++++++++++++++++++++++++++++++++++++
>   2 files changed, 92 insertions(+), 1 deletion(-)
>
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
> index 1901fa8..183f974 100644
> --- a/amdgpu/amdgpu.h
> +++ b/amdgpu/amdgpu.h
> @@ -1328,8 +1328,61 @@ int amdgpu_cs_destroy_semaphore(amdgpu_semaphore_handle sem);
>   */
>   const char *amdgpu_get_marketing_name(amdgpu_device_handle dev);
>   
> +/**
> + *  Create kernel sync object
> + *
> + * \param   dev	      - \c [in]  device handle
> + * \param   syncobj   - \c [out] sync object handle
> + *
> + * \return   0 on success\n
> + *          <0 - Negative POSIX Error code
> + *
> +*/
> +int amdgpu_cs_create_syncobj(amdgpu_device_handle dev,
> +			     uint32_t *syncobj);
> +/**
> + *  Destroy kernel sync object
> + *
> + * \param   dev	    - \c [in] device handle
> + * \param   syncobj - \c [in] sync object handle
> + *
> + * \return   0 on success\n
> + *          <0 - Negative POSIX Error code
> + *
> +*/
> +int amdgpu_cs_destroy_syncobj(amdgpu_device_handle dev,
> +			      uint32_t syncobj);
> +
> +/**
> + *  Export kernel sync object to shareable fd.
> + *
> + * \param   dev	       - \c [in] device handle
> + * \param   syncobj    - \c [in] sync object handle
> + * \param   shared_fd  - \c [out] shared file descriptor.
> + *
> + * \return   0 on success\n
> + *          <0 - Negative POSIX Error code
> + *
> +*/
> +int amdgpu_cs_export_syncobj(amdgpu_device_handle dev,
> +			     uint32_t syncobj,
> +			     int *shared_fd);
> +/**
> + *  Import kernel sync object from shareable fd.
> + *
> + * \param   dev	       - \c [in] device handle
> + * \param   shared_fd  - \c [in] shared file descriptor.
> + * \param   syncobj    - \c [out] sync object handle
> + *
> + * \return   0 on success\n
> + *          <0 - Negative POSIX Error code
> + *
> +*/
> +int amdgpu_cs_import_syncobj(amdgpu_device_handle dev,
> +			     int shared_fd,
> +			     uint32_t *syncobj);
> +
>   #ifdef __cplusplus
>   }
>   #endif
> -
>   #endif /* #ifdef _AMDGPU_H_ */
> diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
> index 868eb7b..722fd75 100644
> --- a/amdgpu/amdgpu_cs.c
> +++ b/amdgpu/amdgpu_cs.c
> @@ -596,3 +596,41 @@ int amdgpu_cs_destroy_semaphore(amdgpu_semaphore_handle sem)
>   {
>   	return amdgpu_cs_unreference_sem(sem);
>   }
> +
> +int amdgpu_cs_create_syncobj(amdgpu_device_handle dev,
> +			     uint32_t *handle)
> +{
> +	if (NULL == dev)
> +		return -EINVAL;
> +
> +	return drmSyncobjCreate(dev->fd, 0, handle);
> +}
> +
> +int amdgpu_cs_destroy_syncobj(amdgpu_device_handle dev,
> +			      uint32_t handle)
> +{
> +	if (NULL == dev)
> +		return -EINVAL;
> +
> +	return drmSyncobjDestroy(dev->fd, handle);
> +}
> +
> +int amdgpu_cs_export_syncobj(amdgpu_device_handle dev,
> +			     uint32_t handle,
> +			     int *shared_fd)
> +{
> +	if (NULL == dev)
> +		return -EINVAL;
> +
> +	return drmSyncobjHandleToFD(dev->fd, handle, shared_fd);
> +}
> +
> +int amdgpu_cs_import_syncobj(amdgpu_device_handle dev,
> +			     int shared_fd,
> +			     uint32_t *handle)
> +{
> +	if (NULL == dev)
> +		return -EINVAL;
> +
> +	return drmSyncobjFDToHandle(dev->fd, shared_fd, handle);
> +}

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-07-18  2:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18  0:48 [PATCH libdrm 1/2] drm/amdgpu: add syncobj create/destroy/import/export apis Dave Airlie
     [not found] ` <20170718004832.21206-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-18  0:48   ` [PATCH libdrm 2/2] drm/amdgpu: add new low overhead command submission API Dave Airlie
2017-07-18 13:51     ` Christian König
2017-07-18  2:48   ` zhoucm1 [this message]
2017-07-18 13:49 ` [PATCH libdrm 1/2] drm/amdgpu: add syncobj create/destroy/import/export apis Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=596D7700.9000102@amd.com \
    --to=david1.zhou-5c7gfcevmho@public.gmane.org \
    --cc=airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.