[libdrm,1/4] amdgpu: add sync_file import and export functions

Submitted by Marek Olšák on Sept. 12, 2017, 8:43 p.m.

Details

Message ID 1505248992-1898-1-git-send-email-maraeo@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Marek Olšák Sept. 12, 2017, 8:43 p.m.
From: Marek Olšák <marek.olsak@amd.com>

---
 amdgpu/amdgpu.h    | 30 ++++++++++++++++++++++++++++++
 amdgpu/amdgpu_cs.c | 20 ++++++++++++++++++++
 2 files changed, 50 insertions(+)

Patch hide | download patch | download mbox

diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 238b1aa..b44b9b6 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -1383,6 +1383,36 @@  int amdgpu_cs_import_syncobj(amdgpu_device_handle dev,
 			     uint32_t *syncobj);
 
 /**
+ *  Export kernel sync object to a sync_file.
+ *
+ * \param   dev	       - \c [in] device handle
+ * \param   syncobj    - \c [in] sync object handle
+ * \param   sync_file_fd - \c [out] sync_file file descriptor.
+ *
+ * \return   0 on success\n
+ *          <0 - Negative POSIX Error code
+ *
+ */
+int amdgpu_cs_syncobj_export_sync_file(amdgpu_device_handle dev,
+				       uint32_t syncobj,
+				       int *sync_file_fd);
+
+/**
+ *  Import kernel sync object from a sync_file.
+ *
+ * \param   dev	       - \c [in] device handle
+ * \param   syncobj    - \c [in] sync object handle
+ * \param   sync_file_fd - \c [in] sync_file file descriptor.
+ *
+ * \return   0 on success\n
+ *          <0 - Negative POSIX Error code
+ *
+ */
+int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev,
+				       uint32_t syncobj,
+				       int sync_file_fd);
+
+/**
  *  Submit raw command submission to kernel
  *
  * \param   dev	       - \c [in] device handle
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index dfba875..4a05536 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -635,6 +635,26 @@  int amdgpu_cs_import_syncobj(amdgpu_device_handle dev,
 	return drmSyncobjFDToHandle(dev->fd, shared_fd, handle);
 }
 
+int amdgpu_cs_syncobj_export_sync_file(amdgpu_device_handle dev,
+				       uint32_t syncobj,
+				       int *sync_file_fd)
+{
+	if (NULL == dev)
+		return -EINVAL;
+
+	return drmSyncobjExportSyncFile(dev->fd, syncobj, sync_file_fd);
+}
+
+int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev,
+				       uint32_t syncobj,
+				       int sync_file_fd)
+{
+	if (NULL == dev)
+		return -EINVAL;
+
+	return drmSyncobjImportSyncFile(dev->fd, syncobj, sync_file_fd);
+}
+
 int amdgpu_cs_submit_raw(amdgpu_device_handle dev,
 			 amdgpu_context_handle context,
 			 amdgpu_bo_list_handle bo_list_handle,

Comments

On 12 September 2017 at 21:43, Marek Olšák <maraeo@gmail.com> wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> ---
>  amdgpu/amdgpu.h    | 30 ++++++++++++++++++++++++++++++
>  amdgpu/amdgpu_cs.c | 20 ++++++++++++++++++++
>  2 files changed, 50 insertions(+)
>
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
> index 238b1aa..b44b9b6 100644
> --- a/amdgpu/amdgpu.h
> +++ b/amdgpu/amdgpu.h
> @@ -1383,6 +1383,36 @@ int amdgpu_cs_import_syncobj(amdgpu_device_handle dev,
>                              uint32_t *syncobj);
>
>  /**
> + *  Export kernel sync object to a sync_file.
> + *
> + * \param   dev               - \c [in] device handle
> + * \param   syncobj    - \c [in] sync object handle
> + * \param   sync_file_fd - \c [out] sync_file file descriptor.
> + *
> + * \return   0 on success\n
> + *          <0 - Negative POSIX Error code
> + *
> + */
> +int amdgpu_cs_syncobj_export_sync_file(amdgpu_device_handle dev,
> +                                      uint32_t syncobj,
> +                                      int *sync_file_fd);
> +
> +/**
> + *  Import kernel sync object from a sync_file.
> + *
> + * \param   dev               - \c [in] device handle
> + * \param   syncobj    - \c [in] sync object handle
> + * \param   sync_file_fd - \c [in] sync_file file descriptor.
> + *
> + * \return   0 on success\n
> + *          <0 - Negative POSIX Error code
> + *
> + */
> +int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev,
> +                                      uint32_t syncobj,
> +                                      int sync_file_fd);
> +
Did you run make check? Seems like these (and other newly introduced
symbols) are missing from amdgpu-symbol-check.

Thanks
Emil