Skip to content
Snippets Groups Projects
  1. Aug 03, 2023
  2. Jul 20, 2023
  3. Feb 20, 2023
  4. Feb 17, 2023
  5. Dec 14, 2021
  6. Jul 27, 2021
  7. Jun 10, 2021
  8. May 31, 2021
  9. Mar 09, 2021
  10. Jan 05, 2021
  11. Dec 17, 2020
  12. Jan 14, 2020
  13. Oct 18, 2019
  14. May 16, 2019
  15. May 02, 2019
  16. Apr 01, 2019
  17. Nov 08, 2018
  18. Oct 18, 2018
    • Chunming Zhou's avatar
      drm: add syncobj timeline support v9 · 48197bc5
      Chunming Zhou authored
      
      This patch is for VK_KHR_timeline_semaphore extension, semaphore is called syncobj in kernel side:
      This extension introduces a new type of syncobj that has an integer payload
      identifying a point in a timeline. Such timeline syncobjs support the
      following operations:
         * CPU query - A host operation that allows querying the payload of the
           timeline syncobj.
         * CPU wait - A host operation that allows a blocking wait for a
           timeline syncobj to reach a specified value.
         * Device wait - A device operation that allows waiting for a
           timeline syncobj to reach a specified value.
         * Device signal - A device operation that allows advancing the
           timeline syncobj to a specified value.
      
      v1:
      Since it's a timeline, that means the front time point(PT) always is signaled before the late PT.
      a. signal PT design:
      Signal PT fence N depends on PT[N-1] fence and signal opertion fence, when PT[N] fence is signaled,
      the timeline will increase to value of PT[N].
      b. wait PT design:
      Wait PT fence is signaled by reaching timeline point value, when timeline is increasing, will compare
      wait PTs value with new timeline value, if PT value is lower than timeline value, then wait PT will be
      signaled, otherwise keep in list. syncobj wait operation can wait on any point of timeline,
      so need a RB tree to order them. And wait PT could ahead of signal PT, we need a sumission fence to
      perform that.
      
      v2:
      1. remove unused DRM_SYNCOBJ_CREATE_TYPE_NORMAL. (Christian)
      2. move unexposed denitions to .c file. (Daniel Vetter)
      3. split up the change to drm_syncobj_find_fence() in a separate patch. (Christian)
      4. split up the change to drm_syncobj_replace_fence() in a separate patch.
      5. drop the submission_fence implementation and instead use wait_event() for that. (Christian)
      6. WARN_ON(point != 0) for NORMAL type syncobj case. (Daniel Vetter)
      
      v3:
      1. replace normal syncobj with timeline implemenation. (Vetter and Christian)
          a. normal syncobj signal op will create a signal PT to tail of signal pt list.
          b. normal syncobj wait op will create a wait pt with last signal point, and this wait PT is only signaled by related signal point PT.
      2. many bug fix and clean up
      3. stub fence moving is moved to other patch.
      
      v4:
      1. fix RB tree loop with while(node=rb_first(...)). (Christian)
      2. fix syncobj lifecycle. (Christian)
      3. only enable_signaling when there is wait_pt. (Christian)
      4. fix timeline path issues.
      5. write a timeline test in libdrm
      
      v5: (Christian)
      1. semaphore is called syncobj in kernel side.
      2. don't need 'timeline' characters in some function name.
      3. keep syncobj cb.
      
      v6: (Christian)
      1. merge syncobj_timeline to syncobj structure.
      2. simplify some check sentences.
      3. some misc change.
      4. fix CTS failed issue.
      
      v7: (Christian)
      1. error handling when creating signal pt.
      2. remove timeline naming in func.
      3. export flags in find_fence.
      4. allow reset timeline.
      
      v8:
      1. use wait_event_interruptible without timeout
      2. rename _TYPE_INDIVIDUAL to _TYPE_BINARY
      
      v9:
      1. rename signal_pt->base to signal_pt->fence_array to avoid misleading
      2. improve kerneldoc
      
      individual syncobj is tested by ./deqp-vk -n dEQP-VK*semaphore*
      timeline syncobj is tested by ./amdgpu_test -s 9
      
      Signed-off-by: default avatarChunming Zhou <david1.zhou@amd.com>
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Cc: Christian Konig <christian.koenig@amd.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Daniel Rakos <Daniel.Rakos@amd.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/257258/
      48197bc5
  19. Jun 20, 2018
  20. May 11, 2018
    • Ankit Nautiyal's avatar
      drm: Add DRM client cap for aspect-ratio · 7595bda2
      Ankit Nautiyal authored
      
      To enable aspect-ratio support in DRM, blindly exposing the aspect
      ratio information along with mode, can break things in existing
      non-atomic user-spaces which have no intention or support to use this
      aspect ratio information.
      
      To avoid this, a new drm client cap is required to enable a non-atomic
      user-space to advertise if it supports modes with aspect-ratio. Based
      on this cap value, the kernel will take a call on exposing the aspect
      ratio info in modes or not.
      
      This patch adds the client cap for aspect-ratio.
      
      Since no atomic-userspaces blow up on receiving aspect-ratio
      information, the client cap for aspect-ratio is always enabled
      for atomic clients.
      
      Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
      Cc: Shashank Sharma <shashank.sharma@intel.com>
      Signed-off-by: default avatarAnkit Nautiyal <ankit.k.nautiyal@intel.com>
      
      V3: rebase
      V4: As suggested by Marteen Lankhorst modified the commit message
          explaining the need to use the DRM cap for aspect-ratio. Also,
          tweaked the comment lines in the code for better understanding and
          clarity, as recommended by Shashank Sharma.
      V5: rebase
      V6: rebase
      V7: rebase
      V8: rebase
      V9: rebase
      V10: rebase
      V11: rebase
      V12: As suggested by Daniel Vetter and Ville Syrjala,
           always enable aspect-ratio client cap for atomic userspaces,
           if no atomic userspace breaks on aspect-ratio bits.
      V13: rebase
      V14: rebase
      
      Reviewed-by: default avatarShashank Sharma <shashank.sharma@intel.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1525777785-9740-7-git-send-email-ankit.k.nautiyal@intel.com
      7595bda2
  21. Oct 25, 2017
    • Keith Packard's avatar
      drm: Add four ioctls for managing drm mode object leases [v7] · 62884cd3
      Keith Packard authored
      
      drm_mode_create_lease
      
      	Creates a lease for a list of drm mode objects, returning an
      	fd for the new drm_master and a 64-bit identifier for the lessee
      
      drm_mode_list_lesees
      
      	List the identifiers of the lessees for a master file
      
      drm_mode_get_lease
      
      	List the leased objects for a master file
      
      drm_mode_revoke_lease
      
      	Erase the set of objects managed by a lease.
      
      This should suffice to at least create and query leases.
      
      Changes for v2 as suggested by Daniel Vetter <daniel.vetter@ffwll.ch>:
      
       * query ioctls only query the master associated with
         the provided file.
      
       * 'mask_lease' value has been removed
      
       * change ioctl has been removed.
      
      Changes for v3 suggested in part by Dave Airlie <airlied@gmail.com>
      
       * Add revoke ioctl.
      
      Changes for v4 suggested by Dave Airlie <airlied@gmail.com>
      
       * Expand on the comment about the magic use of &drm_lease_idr_object
       * Pad lease ioctl structures to align on 64-bit boundaries
      
      Changes for v5 suggested by Dave Airlie <airlied@gmail.com>
      
       * Check for non-negative object_id in create_lease to avoid debug
         output from the kernel.
      
      Changes for v6 provided by Dave Airlie <airlied@gmail.com>
      
       * For non-universal planes add primary/cursor planes to lease
      
         If we aren't exposing universal planes to this userspace client,
         and it requests a lease on a crtc, we should implicitly export the
         primary and cursor planes for the crtc.
      
         If the lessee doesn't request universal planes, it will just see
         the crtc, but if it does request them it will then see the plane
         objects as well.
      
         This also moves the object look ups earlier as a side effect, so
         we'd exit the ioctl quicker for non-existant objects.
      
       * Restrict leases to crtc/connector/planes.
      
         This only allows leasing for objects we wish to allow.
      
      Changes for v7 provided by Dave Airlie <airlied@gmail.com>
      
       * Check pad args are 0
       * Check create flags and object count are valid.
       * Check return from fd allocation
       * Refactor lease idr setup and add some simple validation
       * Use idr_mutex uniformly (Keith)
      
      Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      62884cd3
  22. Oct 23, 2017
    • Keith Packard's avatar
      drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v3] · 3064abfa
      Keith Packard authored
      
      These provide crtc-id based functions instead of pipe-number, while
      also offering higher resolution time (ns) and wider frame count (64)
      as required by the Vulkan API.
      
      v2:
      
       * Check for DRIVER_MODESET in new crtc-based vblank ioctls
      
      	Failing to check this will oops the driver.
      
       * Ensure vblank interupt is running in crtc_get_sequence ioctl
      
      	The sequence and timing values are not correct while the
      	interrupt is off, so make sure it's running before asking for
      	them.
      
       * Short-circuit get_sequence if the counter is enabled and accurate
      
      	Steal the idea from the code in wait_vblank to avoid the
      	expense of drm_vblank_get/put
      
       * Return active state of crtc in crtc_get_sequence ioctl
      
      	Might be useful for applications that aren't in charge of
      	modesetting?
      
       * Use drm_crtc_vblank_get/put in new crtc-based vblank sequence ioctls
      
      	Daniel Vetter prefers these over the old drm_vblank_put/get
      	APIs.
      
       * Return s64 ns instead of u64 in new sequence event
      
      Suggested-by: default avatarDaniel Vetter <daniel@ffwll.ch>
      Suggested-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      
      v3:
      
       * Removed FIRST_PIXEL_OUT_FLAG
       * Document that the timestamp in the query and event are
         that of the first pixel leaving the display engine for
         the display (using the same wording as the Vulkan spec).
      
      Suggested-by: default avatarMichel Dänzer <michel@daenzer.net>
      Acked-by: default avatarDave Airlie <airlied@redhat.com>
      
      [airlied: left->leaves (Michel)]
      
      Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
      Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      3064abfa
  23. Aug 29, 2017
    • Faith Ekstrand's avatar
      drm/syncobj: Add a signal ioctl (v3) · ffa9443f
      Faith Ekstrand authored
      
      This IOCTL provides a mechanism for userspace to trigger a sync object
      directly.  There are other ways that userspace can trigger a syncobj
      such as submitting a dummy batch somewhere or hanging on to a triggered
      sync_file and doing an import.  This just provides an easy way to
      manually trigger the sync object without weird hacks.
      
      The motivation for this IOCTL is Vulkan fences.  Vulkan lets you create
      a fence already in the signaled state so that you can wait on it
      immediatly without stalling.  We could also handle this with a new
      create flag to ask the driver to create a syncobj that is already
      signaled but the IOCTL seemed a bit cleaner and more generic.
      
      v2:
       - Take an array of sync objects (Dave Airlie)
      v3:
       - Throw -EINVAL if pad != 0
      
      Signed-off-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      ffa9443f
    • Faith Ekstrand's avatar
      drm/syncobj: Add a reset ioctl (v3) · aa4035d2
      Faith Ekstrand authored
      
      This just resets the dma_fence to NULL so it looks like it's never been
      signaled.  This will be useful once we add the new wait API for allowing
      wait on "submit and signal" behavior.
      
      v2:
       - Take an array of sync objects (Dave Airlie)
      v3:
       - Throw -EINVAL if pad != 0
      
      Signed-off-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      aa4035d2
  24. Aug 28, 2017
    • Faith Ekstrand's avatar
      drm/syncobj: Allow wait for submit and signal behavior (v5) · e7aca503
      Faith 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
    • Faith Ekstrand's avatar
      drm/syncobj: Add a CREATE_SIGNALED flag · 1fc08218
      Faith Ekstrand authored
      
      This requests that the driver create the sync object such that it
      already has a signaled dma_fence attached.  Because we don't need
      anything in particular (just something signaled), we use a dummy null
      fence.  This is useful for Vulkan which has a similar flag that can be
      passed to vkCreateFence.
      
      Signed-off-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      1fc08218
    • Dave Airlie's avatar
      drm/syncobj: add sync obj wait interface. (v8) · 5e60a10e
      Dave Airlie authored
      
      This interface will allow sync object to be used to back
      Vulkan fences. This API is pretty much the vulkan fence waiting
      API, and I've ported the code from amdgpu.
      
      v2: accept relative timeout, pass remaining time back
      to userspace.
      v3: return to absolute timeouts.
      v4: absolute zero = poll,
          rewrite any/all code to have same operation for arrays
          return -EINVAL for 0 fences.
      v4.1: fixup fences allocation check, use u64_to_user_ptr
      v5: move to sec/nsec, and use timespec64 for calcs.
      v6: use -ETIME and drop the out status flag. (-ETIME
      is suggested by ickle, I can feel a shed painting)
      v7: talked to Daniel/Arnd, use ktime and ns everywhere.
      v8: be more careful in the timeout calculations
          use uint32_t for counter variables so we don't overflow
          graciously handle -ENOINT being returned from dma_fence_wait_timeout
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      5e60a10e
  25. Jun 14, 2017
    • Dave Airlie's avatar
      drm/syncobj: add sync_file interaction. (v1.2) · 3ee45a3b
      Dave Airlie authored
      
      This interface allows importing the fence from a sync_file into
      an existing drm sync object, or exporting the fence attached to
      an existing drm sync object into a new sync file object.
      
      This should only be used to interact with sync files where necessary.
      
      v1.1: fence put fixes (Chris), drop fence from ioctl names (Chris)
      fixup for new fence replace API.
      
      Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      3ee45a3b
    • Dave Airlie's avatar
      drm: introduce sync objects (v4) · e9083420
      Dave Airlie authored
      
      Sync objects are new toplevel drm object, that contain a
      pointer to a fence. This fence can be updated via command
      submission ioctls via drivers.
      
      There is also a generic wait obj API modelled on the vulkan
      wait API (with code modelled on some amdgpu code).
      
      These objects can be converted to an opaque fd that can be
      passes between processes.
      
      v2: rename reference/unreference to put/get (Chris)
      fix leaked reference (David Zhou)
      drop mutex in favour of cmpxchg (Chris)
      v3: cleanups from danvet, rebase on drm_fops rename
      check fd_flags is 0 in ioctls.
      v4: export find/free, change replace fence to take a
      syncobj. In order to support lookup first, replace
      later semantics which seem in the end to be cleaner.
      
      Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      e9083420
  26. Apr 04, 2017
  27. Aug 10, 2016
  28. May 13, 2016
Loading