Re: [PATCH igt 1/3] benchmark/gem_busy: Compare polling with syncobj_wait

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 28/09/2017 10:07, Chris Wilson wrote:
Quoting Tvrtko Ursulin (2017-09-28 07:53:56)

On 25/09/2017 21:26, Chris Wilson wrote:
Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
   benchmarks/gem_busy.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++-
   1 file changed, 72 insertions(+), 1 deletion(-)

diff --git a/benchmarks/gem_busy.c b/benchmarks/gem_busy.c
index f050454b..9649ea02 100644
--- a/benchmarks/gem_busy.c
+++ b/benchmarks/gem_busy.c
@@ -58,6 +58,15 @@
   #define DMABUF 0x4
   #define WAIT 0x8
   #define SYNC 0x10
+#define SYNCOBJ 0x20
+
+#define LOCAL_I915_EXEC_FENCE_ARRAY (1 << 19)
+struct local_gem_exec_fence {
+     uint32_t handle;
+     uint32_t flags;
+#define LOCAL_EXEC_FENCE_WAIT (1 << 0)
+#define LOCAL_EXEC_FENCE_SIGNAL (1 << 1)
+};
static void gem_busy(int fd, uint32_t handle)
   {
@@ -109,11 +118,54 @@ static int sync_merge(int fd1, int fd2)
       return data.fence;
   }
+static uint32_t __syncobj_create(int fd)
+{
+     struct local_syncobj_create {
+             uint32_t handle, flags;
+     } arg;
+#define LOCAL_IOCTL_SYNCOBJ_CREATE        DRM_IOWR(0xBF, struct local_syncobj_create)
+
+     memset(&arg, 0, sizeof(arg));
+     ioctl(fd, LOCAL_IOCTL_SYNCOBJ_CREATE, &arg);
+
+     return arg.handle;
+}
+
+static uint32_t syncobj_create(int fd)
+{
+     uint32_t ret;
+
+     igt_assert_neq((ret = __syncobj_create(fd)), 0);
+
+     return ret;
+}
+
+#define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
+#define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
+struct local_syncobj_wait {
+       __u64 handles;
+       /* absolute timeout */
+       __s64 timeout_nsec;
+       __u32 count_handles;
+       __u32 flags;
+       __u32 first_signaled; /* only valid when not waiting all */
+       __u32 pad;
+};
+#define LOCAL_IOCTL_SYNCOBJ_WAIT     DRM_IOWR(0xC3, struct local_syncobj_wait)
+static int __syncobj_wait(int fd, struct local_syncobj_wait *args)
+{
+     int err = 0;
+     if (drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_WAIT, args))
+             err = -errno;
+     return err;
+}
+
   static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
   {
       struct drm_i915_gem_execbuffer2 execbuf;
       struct drm_i915_gem_exec_object2 obj[2];
       struct drm_i915_gem_relocation_entry reloc[2];
+     struct local_gem_exec_fence syncobj;
       unsigned engines[16];
       unsigned nengine;
       uint32_t *batch;
@@ -126,6 +178,11 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
       fd = drm_open_driver(DRIVER_INTEL);
       gen = intel_gen(intel_get_drm_devid(fd));
+ if (flags & SYNCOBJ) {
+             syncobj.handle = syncobj_create(fd);
+             syncobj.flags = LOCAL_EXEC_FENCE_SIGNAL;
+     }
+
       memset(obj, 0, sizeof(obj));
       obj[0].handle = gem_create(fd, 4096);
       if (flags & WRITE)
@@ -144,6 +201,8 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
       execbuf.buffer_count = 2;
       execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
       execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
+     if (flags & SYNCOBJ)
+             execbuf.flags |= LOCAL_I915_EXEC_FENCE_ARRAY;

According to the comment in i915_drm.h, when this is specified, syncobj
should be also passed in in cliprects_ptr but that's not happening?

You want -b support as well! :)

I just failed to figure out where is the connection between syncobj (local var) and execbuf. Flag is set, so what happens next? Execbuf fails since cliprects_ptr is not set?

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux