Skip to contentSkip to conversation

drm/amdgpu: add the interface of waiting multiple fences (v3)

PATCH In review Alex Deucher 5 participants 5 messages Sep 12, 2016 – Sep 26, 2016 4 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: add the interface of waiting multiple fences (v3)

From: Junwei Zhang <[email protected]>

v2: agd: rebase and squash in all the previous optimizations and changes so everything compiles.
v3: squash in Slava's 32bit build fix

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 171 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |   1 +
 include/uapi/drm/amdgpu_drm.h           |  27 +++++
 4 files changed, 201 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 39baabe..4d6c42f 100644
@@ -1855,6 +1855,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
 			struct drm_file *filp);
 int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
 int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
+int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
+				struct drm_file *filp);
 
 int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
 				struct drm_file *filp);
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +171 -0

177 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -0
index c2c7fb1..88ca1dc 100644
@@ -775,6 +775,7 @@ const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
 	DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES, amdgpu_cs_wait_fences_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
include/uapi/drm/amdgpu_drm.h +27 -0
index d6b5a21..dd9c99c 100644
@@ -50,6 +50,7 @@ extern "C" {
 #define DRM_AMDGPU_WAIT_CS		0x09
 #define DRM_AMDGPU_GEM_OP		0x10
 #define DRM_AMDGPU_GEM_USERPTR		0x11
+#define DRM_AMDGPU_WAIT_FENCES		0x12
 
 #define DRM_IOCTL_AMDGPU_GEM_CREATE	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
 #define DRM_IOCTL_AMDGPU_GEM_MMAP	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
@@ -63,6 +64,7 @@ extern "C" {
 #define DRM_IOCTL_AMDGPU_WAIT_CS	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
 #define DRM_IOCTL_AMDGPU_GEM_OP		DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
 #define DRM_IOCTL_AMDGPU_GEM_USERPTR	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
+#define DRM_IOCTL_AMDGPU_WAIT_FENCES	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
 
 #define AMDGPU_GEM_DOMAIN_CPU		0x1
 #define AMDGPU_GEM_DOMAIN_GTT		0x2
@@ -305,6 +307,31 @@ union drm_amdgpu_wait_cs {
 	struct drm_amdgpu_wait_cs_out out;
 };
 
+struct drm_amdgpu_fence {
+	__u32 ctx_id;
+	__u32 ip_type;
+	__u32 ip_instance;
+	__u32 ring;
+	__u64 seq_no;
+};
+
+struct drm_amdgpu_wait_fences_in {
+	/** This points to uint64_t * which points to fences */
+	__u64 fences;
+	__u32 fence_count;
+	__u32 wait_all;
+	__u64 timeout_ns;
+};
+
+struct drm_amdgpu_wait_fences_out {
+	__u64 status;
+};
+
+union drm_amdgpu_wait_fences {
+	struct drm_amdgpu_wait_fences_in in;
+	struct drm_amdgpu_wait_fences_out out;
+};
+
 #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO	0
 #define AMDGPU_GEM_OP_SET_PLACEMENT		1
 
Signature · 6 lines
2.5.5

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1473698408-17817-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Seems like this is missing the update corresponding to libdrm patch "amdgpu: cs_wait_fences now can return the first signaled fence index". Is the kernel patch for that update also available or going to be sent to the list?

Yours sincerely,
Bas Nieuwenhuizen

Quoted 278 lines · Alex Deucher

From: Junwei Zhang <[email protected]>

v2: agd: rebase and squash in all the previous optimizations and changes so everything compiles.
v3: squash in Slava's 32bit build fix

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 171 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |   1 +
 include/uapi/drm/amdgpu_drm.h           |  27 +++++
 4 files changed, 201 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 39baabe..4d6c42f 100644
@@ -1855,6 +1855,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
                        struct drm_file *filp);
 int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
 int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
+int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
+                               struct drm_file *filp);
 
 int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
                                struct drm_file *filp);
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +171 -0
index e29e7b9..384856c 100644
@@ -1105,6 +1105,177 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,
 }
 
 /**
+ * amdgpu_cs_get_fence - helper to get fence from drm_amdgpu_fence
+ *
+ * @adev: amdgpu device
+ * @filp: file private
+ * @user: drm_amdgpu_fence copied from user space
+ */
+static struct fence *amdgpu_cs_get_fence(struct amdgpu_device *adev,
+                                        struct drm_file *filp,
+                                        struct drm_amdgpu_fence *user)
+{
+       struct amdgpu_ring *ring;
+       struct amdgpu_ctx *ctx;
+       struct fence *fence;
+       int r;
+
+       r = amdgpu_cs_get_ring(adev, user->ip_type, user->ip_instance,
+                              user->ring, &ring);
+       if (r)
+               return ERR_PTR(r);
+
+       ctx = amdgpu_ctx_get(filp->driver_priv, user->ctx_id);
+       if (ctx == NULL)
+               return ERR_PTR(-EINVAL);
+
+       fence = amdgpu_ctx_get_fence(ctx, ring, user->seq_no);
+       amdgpu_ctx_put(ctx);
+
+       return fence;
+}
+
+/**
+ * amdgpu_cs_wait_all_fence - wait on all fences to signal
+ *
+ * @adev: amdgpu device
+ * @filp: file private
+ * @wait: wait parameters
+ * @fences: array of drm_amdgpu_fence
+ */
+static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
+                                    struct drm_file *filp,
+                                    union drm_amdgpu_wait_fences *wait,
+                                    struct drm_amdgpu_fence *fences)
+{
+       uint32_t fence_count = wait->in.fence_count;
+       unsigned i;
+       long r = 1;
+
+       for (i = 0; i < fence_count; i++) {
+               struct fence *fence;
+               unsigned long timeout = amdgpu_gem_timeout(wait->in.timeout_ns);
+
+               fence = amdgpu_cs_get_fence(adev, filp, &fences[i]);
+               if (IS_ERR(fence))
+                       return PTR_ERR(fence);
+               else if (!fence)
+                       continue;
+
+               r = fence_wait_timeout(fence, true, timeout);
+               if (r < 0)
+                       return r;
+
+               if (r == 0)
+                       break;
+       }
+
+       memset(wait, 0, sizeof(*wait));
+       wait->out.status = (r > 0);
+
+       return 0;
+}
+
+/**
+ * amdgpu_cs_wait_any_fence - wait on any fence to signal
+ *
+ * @adev: amdgpu device
+ * @filp: file private
+ * @wait: wait parameters
+ * @fences: array of drm_amdgpu_fence
+ */
+static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
+                                   struct drm_file *filp,
+                                   union drm_amdgpu_wait_fences *wait,
+                                   struct drm_amdgpu_fence *fences)
+{
+       unsigned long timeout = amdgpu_gem_timeout(wait->in.timeout_ns);
+       uint32_t fence_count = wait->in.fence_count;
+       struct fence **array;
+       unsigned i;
+       long r;
+
+       /* Prepare the fence array */
+       array = (struct fence **)kcalloc(fence_count, sizeof(struct fence *),
+                       GFP_KERNEL);
+       if (array == NULL)
+               return -ENOMEM;
+
+       for (i = 0; i < fence_count; i++) {
+               struct fence *fence;
+
+               fence = amdgpu_cs_get_fence(adev, filp, &fences[i]);
+               if (IS_ERR(fence)) {
+                       r = PTR_ERR(fence);
+                       goto err_free_fence_array;
+               } else if (fence) {
+                       array[i] = fence;
+               } else { /* NULL, the fence has been already signaled */
+                       r = 1;
+                       goto out;
+               }
+       }
+
+       r = fence_wait_any_timeout(array, fence_count, true, timeout);
+       if (r < 0)
+               goto err_free_fence_array;
+
+out:
+       memset(wait, 0, sizeof(*wait));
+       wait->out.status = (r > 0);
+       /* set return value 0 to indicate success */
+       r = 0;
+
+err_free_fence_array:
+       for (i = 0; i < fence_count; i++)
+               fence_put(array[i]);
+       kfree(array);
+
+       return r;
+}
+
+/**
+ * amdgpu_cs_wait_fences_ioctl - wait for multiple command submissions to finish
+ *
+ * @dev: drm device
+ * @data: data from userspace
+ * @filp: file private
+ */
+int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
+                               struct drm_file *filp)
+{
+       struct amdgpu_device *adev = dev->dev_private;
+       union drm_amdgpu_wait_fences *wait = data;
+       uint32_t fence_count = wait->in.fence_count;
+       struct drm_amdgpu_fence *fences_user;
+       struct drm_amdgpu_fence *fences;
+       int r;
+
+       /* Get the fences from userspace */
+       fences = kmalloc_array(fence_count, sizeof(struct drm_amdgpu_fence),
+                       GFP_KERNEL);
+       if (fences == NULL)
+               return -ENOMEM;
+
+       fences_user = (void __user *)(unsigned long)(wait->in.fences);
+       if (copy_from_user(fences, fences_user,
+               sizeof(struct drm_amdgpu_fence) * fence_count)) {
+               r = -EFAULT;
+               goto err_free_fences;
+       }
+
+       if (wait->in.wait_all)
+               r = amdgpu_cs_wait_all_fences(adev, filp, wait, fences);
+       else
+               r = amdgpu_cs_wait_any_fence(adev, filp, wait, fences);
+
+err_free_fences:
+       kfree(fences);
+
+       return r;
+}
+
+/**
  * amdgpu_cs_find_bo_va - find bo_va for VM address
  *
  * @parser: command submission parser context
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -0
index c2c7fb1..88ca1dc 100644
@@ -775,6 +775,7 @@ const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
        DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
        DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
        DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+       DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES, amdgpu_cs_wait_fences_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
        DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
        DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
        DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
include/uapi/drm/amdgpu_drm.h +27 -1
index d6b5a21..dd9c99c 100644
@@ -50,6 +50,7 @@ extern "C" {
 #define DRM_AMDGPU_WAIT_CS             0x09
 #define DRM_AMDGPU_GEM_OP              0x10
 #define DRM_AMDGPU_GEM_USERPTR         0x11
+#define DRM_AMDGPU_WAIT_FENCES         0x12
 
 #define DRM_IOCTL_AMDGPU_GEM_CREATE    DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
 #define DRM_IOCTL_AMDGPU_GEM_MMAP      DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
@@ -63,6 +64,7 @@ extern "C" {
 #define DRM_IOCTL_AMDGPU_WAIT_CS       DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
 #define DRM_IOCTL_AMDGPU_GEM_OP                DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
 #define DRM_IOCTL_AMDGPU_GEM_USERPTR   DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
+#define DRM_IOCTL_AMDGPU_WAIT_FENCES   DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
 
 #define AMDGPU_GEM_DOMAIN_CPU          0x1
 #define AMDGPU_GEM_DOMAIN_GTT          0x2
@@ -305,6 +307,31 @@ union drm_amdgpu_wait_cs {
        struct drm_amdgpu_wait_cs_out out;
 };
 
+struct drm_amdgpu_fence {
+       __u32 ctx_id;
+       __u32 ip_type;
+       __u32 ip_instance;
+       __u32 ring;
+       __u64 seq_no;
+};
+
+struct drm_amdgpu_wait_fences_in {
+       /** This points to uint64_t * which points to fences */
+       __u64 fences;
+       __u32 fence_count;
+       __u32 wait_all;
+       __u64 timeout_ns;
+};
+
+struct drm_amdgpu_wait_fences_out {
+       __u64 status;
+};
+
+union drm_amdgpu_wait_fences {
+       struct drm_amdgpu_wait_fences_in in;
+       struct drm_amdgpu_wait_fences_out out;
+};
+
 #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO      0
 #define AMDGPU_GEM_OP_SET_PLACEMENT            1
 
--

2.5.5

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CAP+8YyGL9C9rM0c5r5R0GuRQhQptE=3baaeLB71PLGYMJuNS+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Yeah, we added that later on.

Looks like Alex (or somebody else) squashed the original and follow up patch for libdrm together, but forgot to do so for the kernel side.

Just wait a moment, if Alex can't find that of hand I'm going to take a look through the branches tomorrow.

Regards,
Christian.

Am 12.09.2016 um 20:34 schrieb Bas Nieuwenhuizen:

Quoted 287 lines

Seems like this is missing the update corresponding to libdrm patch "amdgpu: cs_wait_fences now can return the first signaled fence index". Is the kernel patch for that update also available or going to be sent to the list?

Yours sincerely,
Bas Nieuwenhuizen

Quoted 278 lines · Alex Deucher

From: Junwei Zhang <[email protected]>

v2: agd: rebase and squash in all the previous optimizations and changes so everything compiles.
v3: squash in Slava's 32bit build fix

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     |   2 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 171 ++++++++++++++++++++++++++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |   1 +
  include/uapi/drm/amdgpu_drm.h           |  27 +++++
  4 files changed, 201 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 39baabe..4d6c42f 100644
@@ -1855,6 +1855,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
                         struct drm_file *filp);
  int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
  int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
+int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
+                               struct drm_file *filp);
 
  int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
                                 struct drm_file *filp);
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +171 -0
index e29e7b9..384856c 100644
@@ -1105,6 +1105,177 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,
  }
 
  /**
+ * amdgpu_cs_get_fence - helper to get fence from drm_amdgpu_fence
+ *
+ * @adev: amdgpu device
+ * @filp: file private
+ * @user: drm_amdgpu_fence copied from user space
+ */
+static struct fence *amdgpu_cs_get_fence(struct amdgpu_device *adev,
+                                        struct drm_file *filp,
+                                        struct drm_amdgpu_fence *user)
+{
+       struct amdgpu_ring *ring;
+       struct amdgpu_ctx *ctx;
+       struct fence *fence;
+       int r;
+
+       r = amdgpu_cs_get_ring(adev, user->ip_type, user->ip_instance,
+                              user->ring, &ring);
+       if (r)
+               return ERR_PTR(r);
+
+       ctx = amdgpu_ctx_get(filp->driver_priv, user->ctx_id);
+       if (ctx == NULL)
+               return ERR_PTR(-EINVAL);
+
+       fence = amdgpu_ctx_get_fence(ctx, ring, user->seq_no);
+       amdgpu_ctx_put(ctx);
+
+       return fence;
+}
+
+/**
+ * amdgpu_cs_wait_all_fence - wait on all fences to signal
+ *
+ * @adev: amdgpu device
+ * @filp: file private
+ * @wait: wait parameters
+ * @fences: array of drm_amdgpu_fence
+ */
+static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
+                                    struct drm_file *filp,
+                                    union drm_amdgpu_wait_fences *wait,
+                                    struct drm_amdgpu_fence *fences)
+{
+       uint32_t fence_count = wait->in.fence_count;
+       unsigned i;
+       long r = 1;
+
+       for (i = 0; i < fence_count; i++) {
+               struct fence *fence;
+               unsigned long timeout = amdgpu_gem_timeout(wait->in.timeout_ns);
+
+               fence = amdgpu_cs_get_fence(adev, filp, &fences[i]);
+               if (IS_ERR(fence))
+                       return PTR_ERR(fence);
+               else if (!fence)
+                       continue;
+
+               r = fence_wait_timeout(fence, true, timeout);
+               if (r < 0)
+                       return r;
+
+               if (r == 0)
+                       break;
+       }
+
+       memset(wait, 0, sizeof(*wait));
+       wait->out.status = (r > 0);
+
+       return 0;
+}
+
+/**
+ * amdgpu_cs_wait_any_fence - wait on any fence to signal
+ *
+ * @adev: amdgpu device
+ * @filp: file private
+ * @wait: wait parameters
+ * @fences: array of drm_amdgpu_fence
+ */
+static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
+                                   struct drm_file *filp,
+                                   union drm_amdgpu_wait_fences *wait,
+                                   struct drm_amdgpu_fence *fences)
+{
+       unsigned long timeout = amdgpu_gem_timeout(wait->in.timeout_ns);
+       uint32_t fence_count = wait->in.fence_count;
+       struct fence **array;
+       unsigned i;
+       long r;
+
+       /* Prepare the fence array */
+       array = (struct fence **)kcalloc(fence_count, sizeof(struct fence *),
+                       GFP_KERNEL);
+       if (array == NULL)
+               return -ENOMEM;
+
+       for (i = 0; i < fence_count; i++) {
+               struct fence *fence;
+
+               fence = amdgpu_cs_get_fence(adev, filp, &fences[i]);
+               if (IS_ERR(fence)) {
+                       r = PTR_ERR(fence);
+                       goto err_free_fence_array;
+               } else if (fence) {
+                       array[i] = fence;
+               } else { /* NULL, the fence has been already signaled */
+                       r = 1;
+                       goto out;
+               }
+       }
+
+       r = fence_wait_any_timeout(array, fence_count, true, timeout);
+       if (r < 0)
+               goto err_free_fence_array;
+
+out:
+       memset(wait, 0, sizeof(*wait));
+       wait->out.status = (r > 0);
+       /* set return value 0 to indicate success */
+       r = 0;
+
+err_free_fence_array:
+       for (i = 0; i < fence_count; i++)
+               fence_put(array[i]);
+       kfree(array);
+
+       return r;
+}
+
+/**
+ * amdgpu_cs_wait_fences_ioctl - wait for multiple command submissions to finish
+ *
+ * @dev: drm device
+ * @data: data from userspace
+ * @filp: file private
+ */
+int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
+                               struct drm_file *filp)
+{
+       struct amdgpu_device *adev = dev->dev_private;
+       union drm_amdgpu_wait_fences *wait = data;
+       uint32_t fence_count = wait->in.fence_count;
+       struct drm_amdgpu_fence *fences_user;
+       struct drm_amdgpu_fence *fences;
+       int r;
+
+       /* Get the fences from userspace */
+       fences = kmalloc_array(fence_count, sizeof(struct drm_amdgpu_fence),
+                       GFP_KERNEL);
+       if (fences == NULL)
+               return -ENOMEM;
+
+       fences_user = (void __user *)(unsigned long)(wait->in.fences);
+       if (copy_from_user(fences, fences_user,
+               sizeof(struct drm_amdgpu_fence) * fence_count)) {
+               r = -EFAULT;
+               goto err_free_fences;
+       }
+
+       if (wait->in.wait_all)
+               r = amdgpu_cs_wait_all_fences(adev, filp, wait, fences);
+       else
+               r = amdgpu_cs_wait_any_fence(adev, filp, wait, fences);
+
+err_free_fences:
+       kfree(fences);
+
+       return r;
+}
+
+/**
   * amdgpu_cs_find_bo_va - find bo_va for VM address
   *
   * @parser: command submission parser context
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -0
index c2c7fb1..88ca1dc 100644
@@ -775,6 +775,7 @@ const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
         DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
         DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
         DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+       DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES, amdgpu_cs_wait_fences_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
include/uapi/drm/amdgpu_drm.h +27 -1
index d6b5a21..dd9c99c 100644
@@ -50,6 +50,7 @@ extern "C" {
  #define DRM_AMDGPU_WAIT_CS             0x09
  #define DRM_AMDGPU_GEM_OP              0x10
  #define DRM_AMDGPU_GEM_USERPTR         0x11
+#define DRM_AMDGPU_WAIT_FENCES         0x12
 
  #define DRM_IOCTL_AMDGPU_GEM_CREATE    DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
  #define DRM_IOCTL_AMDGPU_GEM_MMAP      DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
@@ -63,6 +64,7 @@ extern "C" {
  #define DRM_IOCTL_AMDGPU_WAIT_CS       DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
  #define DRM_IOCTL_AMDGPU_GEM_OP                DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
  #define DRM_IOCTL_AMDGPU_GEM_USERPTR   DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
+#define DRM_IOCTL_AMDGPU_WAIT_FENCES   DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
 
  #define AMDGPU_GEM_DOMAIN_CPU          0x1
  #define AMDGPU_GEM_DOMAIN_GTT          0x2
@@ -305,6 +307,31 @@ union drm_amdgpu_wait_cs {
         struct drm_amdgpu_wait_cs_out out;
  };
 
+struct drm_amdgpu_fence {
+       __u32 ctx_id;
+       __u32 ip_type;
+       __u32 ip_instance;
+       __u32 ring;
+       __u64 seq_no;
+};
+
+struct drm_amdgpu_wait_fences_in {
+       /** This points to uint64_t * which points to fences */
+       __u64 fences;
+       __u32 fence_count;
+       __u32 wait_all;
+       __u64 timeout_ns;
+};
+
+struct drm_amdgpu_wait_fences_out {
+       __u64 status;
+};
+
+union drm_amdgpu_wait_fences {
+       struct drm_amdgpu_wait_fences_in in;
+       struct drm_amdgpu_wait_fences_out out;
+};
+
  #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO      0
  #define AMDGPU_GEM_OP_SET_PLACEMENT            1
 
--

2.5.5

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): d1d8996e-88af-4ea1-4659-e0bc8e190898-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#6 lore raw
Quoted 9 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Monday, September 12, 2016 2:46 PM
To: Bas Nieuwenhuizen; Alex Deucher
Cc: Zhang, Jerry; [email protected]
Subject: Re: [PATCH] drm/amdgpu: add the interface of waiting multiple fences (v3)

Quoted 7 lines

Yeah, we added that later on.

Looks like Alex (or somebody else) squashed the original and follow up patch for libdrm together, but forgot to do so for the kernel side.

Just wait a moment, if Alex can't find that of hand I'm going to take a look through the branches tomorrow.

I found it. Looks like the commit message got messed up. I'll fix it up and send it out shortly.

Alex

Quoted 338 lines

Regards,
Christian.

Am 12.09.2016 um 20:34 schrieb Bas Nieuwenhuizen:

Quoted 9 lines

Seems like this is missing the update corresponding to libdrm patch "amdgpu: cs_wait_fences now can return the first signaled fence index". Is the kernel patch for that update also available or going to be sent to the list?

Yours sincerely,
Bas Nieuwenhuizen

On Mon, Sep 12, 2016 at 6:40 PM, Alex Deucher <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines

From: Junwei Zhang <[email protected]>

v2: agd: rebase and squash in all the previous optimizations and changes so everything compiles.
v3: squash in Slava's 32bit build fix

Quoted 6 lines
Quoted 6 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     |   2 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 171

++++++++++++++++++++++++++++++++

Quoted 5 lines

Review

Quoted 5 lines
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |   1 +
  include/uapi/drm/amdgpu_drm.h           |  27 +++++
  4 files changed, 201 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu.h

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h int amdgpu_gem_op_ioctl(struct drm_device

Quoted 4 lines

index 39baabe..4d6c42f 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
@@ -1855,6 +1855,8 @@ int amdgpu_gem_op_ioctl(struct drm_device

*dev, void *data,

Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h int amdgpu_gem_op_ioctl(struct drm_device · line 1856

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
                         struct drm_file *filp);
  int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file

*filp);

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu.h int amdgpu_gem_op_ioctl(struct drm_device · line 1857

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
  int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, struct

drm_file *filp);

Quoted 6 lines

Review

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
+int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
+                               struct drm_file *filp);
 
  int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
                                 struct drm_file *filp);
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_wait_ioctl(struct drm_device

Quoted 4 lines

index e29e7b9..384856c 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
@@ -1105,6 +1105,177 @@ int amdgpu_cs_wait_ioctl(struct drm_device

*dev, void *data,

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_wait_ioctl(struct drm_device · line 1108

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -0
  }
 
  /**
+ * amdgpu_cs_get_fence - helper to get fence from

drm_amdgpu_fence

Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -0
+ *
+ * @adev: amdgpu device
+ * @filp: file private
+ * @user: drm_amdgpu_fence copied from user space
+ */
+static struct fence *amdgpu_cs_get_fence(struct amdgpu_device

*adev,

Quoted 118 lines
Quoted 33 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +33 -0
+                                        struct drm_file *filp,
+                                        struct drm_amdgpu_fence *user)
+{
+       struct amdgpu_ring *ring;
+       struct amdgpu_ctx *ctx;
+       struct fence *fence;
+       int r;
+
+       r = amdgpu_cs_get_ring(adev, user->ip_type, user->ip_instance,
+                              user->ring, &ring);
+       if (r)
+               return ERR_PTR(r);
+
+       ctx = amdgpu_ctx_get(filp->driver_priv, user->ctx_id);
+       if (ctx == NULL)
+               return ERR_PTR(-EINVAL);
+
+       fence = amdgpu_ctx_get_fence(ctx, ring, user->seq_no);
+       amdgpu_ctx_put(ctx);
+
+       return fence;
+}
+
+/**
+ * amdgpu_cs_wait_all_fence - wait on all fences to signal
+ *
+ * @adev: amdgpu device
+ * @filp: file private
+ * @wait: wait parameters
+ * @fences: array of drm_amdgpu_fence
+ */
+static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,
+                                    struct drm_file *filp,

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +10 -0
+                                    union drm_amdgpu_wait_fences *wait,
+                                    struct drm_amdgpu_fence *fences)
+{
+       uint32_t fence_count = wait->in.fence_count;
+       unsigned i;
+       long r = 1;
+
+       for (i = 0; i < fence_count; i++) {
+               struct fence *fence;
+               unsigned long timeout = amdgpu_gem_timeout(wait-

in.timeout_ns);

Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +25 -0
+
+               fence = amdgpu_cs_get_fence(adev, filp, &fences[i]);
+               if (IS_ERR(fence))
+                       return PTR_ERR(fence);
+               else if (!fence)
+                       continue;
+
+               r = fence_wait_timeout(fence, true, timeout);
+               if (r < 0)
+                       return r;
+
+               if (r == 0)
+                       break;
+       }
+
+       memset(wait, 0, sizeof(*wait));
+       wait->out.status = (r > 0);
+
+       return 0;
+}
+
+/**
+ * amdgpu_cs_wait_any_fence - wait on any fence to signal
+ *
+ * @adev: amdgpu device

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +10 -0
+ * @filp: file private
+ * @wait: wait parameters
+ * @fences: array of drm_amdgpu_fence
+ */
+static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
+                                   struct drm_file *filp,
+                                   union drm_amdgpu_wait_fences *wait,
+                                   struct drm_amdgpu_fence *fences)
+{
+       unsigned long timeout = amdgpu_gem_timeout(wait-

in.timeout_ns);

Quoted 38 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +38 -0
+       uint32_t fence_count = wait->in.fence_count;
+       struct fence **array;
+       unsigned i;
+       long r;
+
+       /* Prepare the fence array */
+       array = (struct fence **)kcalloc(fence_count, sizeof(struct fence *),
+                       GFP_KERNEL);
+       if (array == NULL)
+               return -ENOMEM;
+
+       for (i = 0; i < fence_count; i++) {
+               struct fence *fence;
+
+               fence = amdgpu_cs_get_fence(adev, filp, &fences[i]);
+               if (IS_ERR(fence)) {
+                       r = PTR_ERR(fence);
+                       goto err_free_fence_array;
+               } else if (fence) {
+                       array[i] = fence;
+               } else { /* NULL, the fence has been already signaled */
+                       r = 1;
+                       goto out;
+               }
+       }
+
+       r = fence_wait_any_timeout(array, fence_count, true, timeout);
+       if (r < 0)
+               goto err_free_fence_array;
+
+out:
+       memset(wait, 0, sizeof(*wait));
+       wait->out.status = (r > 0);
+       /* set return value 0 to indicate success */
+       r = 0;
+
+err_free_fence_array:
+       for (i = 0; i < fence_count; i++)
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +8 -0
+               fence_put(array[i]);
+       kfree(array);
+
+       return r;
+}
+
+/**
+ * amdgpu_cs_wait_fences_ioctl - wait for multiple command

submissions to finish

Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +9 -0
+ *
+ * @dev: drm device
+ * @data: data from userspace
+ * @filp: file private
+ */
+int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
+                               struct drm_file *filp)
+{
+       struct amdgpu_device *adev = dev->dev_private;
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +8 -0
+       union drm_amdgpu_wait_fences *wait = data;
+       uint32_t fence_count = wait->in.fence_count;
+       struct drm_amdgpu_fence *fences_user;
+       struct drm_amdgpu_fence *fences;
+       int r;
+
+       /* Get the fences from userspace */
+       fences = kmalloc_array(fence_count, sizeof(struct

drm_amdgpu_fence),

Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +19 -0
+                       GFP_KERNEL);
+       if (fences == NULL)
+               return -ENOMEM;
+
+       fences_user = (void __user *)(unsigned long)(wait->in.fences);
+       if (copy_from_user(fences, fences_user,
+               sizeof(struct drm_amdgpu_fence) * fence_count)) {
+               r = -EFAULT;
+               goto err_free_fences;
+       }
+
+       if (wait->in.wait_all)
+               r = amdgpu_cs_wait_all_fences(adev, filp, wait, fences);
+       else
+               r = amdgpu_cs_wait_any_fence(adev, filp, wait, fences);
+
+err_free_fences:
+       kfree(fences);
+
Quoted 8 lines

Review

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -0
+       return r;
+}
+
+/**
   * amdgpu_cs_find_bo_va - find bo_va for VM address
   *
   * @parser: command submission parser context
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c const struct drm_ioctl_desc amdgpu_ioctls_kms[]

Quoted 4 lines

index c2c7fb1..88ca1dc 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
@@ -775,6 +775,7 @@ const struct drm_ioctl_desc amdgpu_ioctls_kms[]

= {

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c const struct drm_ioctl_desc amdgpu_ioctls_kms[] · line 775

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
         DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl,

DRM_AUTH|DRM_RENDER_ALLOW),

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c const struct drm_ioctl_desc amdgpu_ioctls_kms[] · line 776

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
         DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl,

DRM_AUTH|DRM_RENDER_ALLOW),

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c const struct drm_ioctl_desc amdgpu_ioctls_kms[] · line 777

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
         DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl,

DRM_AUTH|DRM_RENDER_ALLOW),

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c const struct drm_ioctl_desc amdgpu_ioctls_kms[] · line 778

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -0
+       DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES,

amdgpu_cs_wait_fences_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c const struct drm_ioctl_desc amdgpu_ioctls_kms[] · line 779

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA,

amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c const struct drm_ioctl_desc amdgpu_ioctls_kms[] · line 780

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl,

DRM_AUTH|DRM_RENDER_ALLOW),

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c const struct drm_ioctl_desc amdgpu_ioctls_kms[] · line 781

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl,

DRM_AUTH|DRM_RENDER_ALLOW),

Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h

Quoted 10 lines

include/uapi/drm/amdgpu_drm.h extern "C" { · line 55

Quoted 10 lines

index d6b5a21..dd9c99c 100644

include/uapi/drm/amdgpu_drm.h +1 -0
@@ -50,6 +50,7 @@ extern "C" {
  #define DRM_AMDGPU_WAIT_CS             0x09
  #define DRM_AMDGPU_GEM_OP              0x10
  #define DRM_AMDGPU_GEM_USERPTR         0x11
+#define DRM_AMDGPU_WAIT_FENCES         0x12
 
  #define DRM_IOCTL_AMDGPU_GEM_CREATE

DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)

Quoted 1 line

include/uapi/drm/amdgpu_drm.h extern "C" { · line 56

Quoted 1 line
include/uapi/drm/amdgpu_drm.h +0 -0
  #define DRM_IOCTL_AMDGPU_GEM_MMAP

DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)

Quoted 2 lines

include/uapi/drm/amdgpu_drm.h extern "C" { · line 64

Quoted 2 lines
include/uapi/drm/amdgpu_drm.h +0 -0
@@ -63,6 +64,7 @@ extern "C" {
  #define DRM_IOCTL_AMDGPU_WAIT_CS

DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)

Quoted 1 line

include/uapi/drm/amdgpu_drm.h extern "C" { · line 65

Quoted 1 line
include/uapi/drm/amdgpu_drm.h +0 -0
  #define DRM_IOCTL_AMDGPU_GEM_OP

DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)

Quoted 1 line

include/uapi/drm/amdgpu_drm.h extern "C" { · line 66

Quoted 1 line
include/uapi/drm/amdgpu_drm.h +0 -0
  #define DRM_IOCTL_AMDGPU_GEM_USERPTR

DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)

Quoted 1 line

include/uapi/drm/amdgpu_drm.h extern "C" { · line 67

Quoted 1 line
include/uapi/drm/amdgpu_drm.h +1 -0
+#define DRM_IOCTL_AMDGPU_WAIT_FENCES

DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)

Quoted 38 lines
Quoted 38 lines
include/uapi/drm/amdgpu_drm.h +25 -1
  #define AMDGPU_GEM_DOMAIN_CPU          0x1
  #define AMDGPU_GEM_DOMAIN_GTT          0x2
@@ -305,6 +307,31 @@ union drm_amdgpu_wait_cs {
         struct drm_amdgpu_wait_cs_out out;
  };
 
+struct drm_amdgpu_fence {
+       __u32 ctx_id;
+       __u32 ip_type;
+       __u32 ip_instance;
+       __u32 ring;
+       __u64 seq_no;
+};
+
+struct drm_amdgpu_wait_fences_in {
+       /** This points to uint64_t * which points to fences */
+       __u64 fences;
+       __u32 fence_count;
+       __u32 wait_all;
+       __u64 timeout_ns;
+};
+
+struct drm_amdgpu_wait_fences_out {
+       __u64 status;
+};
+
+union drm_amdgpu_wait_fences {
+       struct drm_amdgpu_wait_fences_in in;
+       struct drm_amdgpu_wait_fences_out out;
+};
+
  #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO      0
  #define AMDGPU_GEM_OP_SET_PLACEMENT            1
 
--

2.5.5

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB16839DB76854145B5D00E505F7FF0-/b2+HYfkarTZ9ihocuPUdQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#8 lore raw
Quoted 11 lines · Alexander
Quoted 11 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Monday, September 12, 2016 2:46 PM
To: Bas Nieuwenhuizen; Alex Deucher
Cc: Zhang, Jerry; [email protected]
Subject: Re: [PATCH] drm/amdgpu: add the interface of waiting multiple fences (v3)

Yeah, we added that later on.

Quoted 8 lines
Quoted 5 lines

Looks like Alex (or somebody else) squashed the original and follow up patch for libdrm together, but forgot to do so for the kernel side.

Just wait a moment, if Alex can't find that of hand I'm going to take a look through the branches tomorrow.

I found it. Looks like the commit message got messed up. I'll fix it up and send it out shortly.

Is this also missing an interface version bump so we know we can use it?

Dave.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx