1. 29 Aug, 2017 38 commits
  2. 28 Aug, 2017 2 commits
    • Jason Ekstrand's avatar
      drm/syncobj: Add a syncobj_array_find helper · 3e6fb72d
      Jason Ekstrand authored
      The wait ioctl has a bunch of code to read an syncobj handle array from
      userspace and turn it into an array of syncobj pointers.  We're about to
      add two new IOCTLs which will need to work with arrays of syncobj
      handles so let's make some helpers.
      Signed-off-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      3e6fb72d
    • Jason Ekstrand's avatar
      drm/syncobj: Allow wait for submit and signal behavior (v5) · e7aca503
      Jason Ekstrand authored
      Vulkan VkFence semantics require that the application be able to perform
      a CPU wait on work which may not yet have been submitted.  This is
      perfectly safe because the CPU wait has a timeout which will get
      triggered eventually if no work is ever submitted.  This behavior is
      advantageous for multi-threaded workloads because, so long as all of the
      threads agree on what fences to use up-front, you don't have the extra
      cross-thread synchronization cost of thread A telling thread B that it
      has submitted its dependent work and thread B is now free to wait.
      
      Within a single process, this can be implemented in the userspace driver
      by doing exactly the same kind of tracking the app would have to do
      using posix condition variables or similar.  However, in order for this
      to work cross-process (as is required by VK_KHR_external_fence), we need
      to handle this in the kernel.
      
      This commit adds a WAIT_FOR_SUBMIT flag to DRM_IOCTL_SYNCOBJ_WAIT which
      instructs the IOCTL to wait for the syncobj to have a non-null fence and
      then wait on the fence.  Combined with DRM_IOCTL_SYNCOBJ_RESET, you can
      easily get the Vulkan behavior.
      
      v2:
       - Fix a bug in the invalid syncobj error path
       - Unify the wait-all and wait-any cases
      v3:
       - Unify the timeout == 0 case a bit with the timeout > 0 case
       - Use wait_event_interruptible_timeout
      v4:
       - Use proxy fence
      v5:
       - Revert to a combination of v2 and v3
       - Don't use proxy fences
       - Don't use wait_event_interruptible_timeout because it just adds an
         extra layer of callbacks
      Signed-off-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Christian König <christian.koenig@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      e7aca503