1. 08 4月, 2021 1 次提交
  2. 05 1月, 2021 1 次提交
  3. 09 11月, 2020 1 次提交
  4. 22 10月, 2020 1 次提交
  5. 21 9月, 2020 1 次提交
  6. 17 7月, 2020 1 次提交
    • L
      drm/vblank: Add vblank works · 5e6c2b4f
      Lyude Paul 提交于
      Add some kind of vblank workers. The interface is similar to regular
      delayed works, and is mostly based off kthread_work. It allows for
      scheduling delayed works that execute once a particular vblank sequence
      has passed. It also allows for accurate flushing of scheduled vblank
      works - in that flushing waits for both the vblank sequence and job
      execution to complete, or for the work to get cancelled - whichever
      comes first.
      
      Whatever hardware programming we do in the work must be fast (must at
      least complete during the vblank or scanout period, sometimes during the
      first few scanlines of the vblank). As such we use a high-priority
      per-CRTC thread to accomplish this.
      
      Changes since v7:
      * Stuff drm_vblank_internal.h and drm_vblank_work_internal.h contents
        into drm_internal.h
      * Get rid of unnecessary spinlock in drm_crtc_vblank_on()
      * Remove !vblank->worker check
      * Grab vbl_lock in drm_vblank_work_schedule()
      * Mention self-rearming work items in drm_vblank_work_schedule() kdocs
      * Return 1 from drm_vblank_work_schedule() if the work was scheduled
        successfully, 0 or error code otherwise
      * Use drm_dbg_core() instead of DRM_DEV_ERROR() in
        drm_vblank_work_schedule()
      * Remove vblank->worker checks in drm_vblank_destroy_worker() and
        drm_vblank_flush_worker()
      Changes since v6:
      * Get rid of ->pending and seqcounts, and implement flushing through
        simpler means - danvet
      * Get rid of work_lock, just use drm_device->event_lock
      * Move drm_vblank_work item cleanup into drm_crtc_vblank_off() so that
        we ensure that all vblank work has finished before disabling vblanks
      * Add checks into drm_crtc_vblank_reset() so we yell if it gets called
        while there's vblank workers active
      * Grab event_lock in both drm_crtc_vblank_on()/drm_crtc_vblank_off(),
        the main reason for this is so that other threads calling
        drm_vblank_work_schedule() are blocked from attempting to schedule
        while we're in the middle of enabling/disabling vblanks.
      * Move drm_handle_vblank_works() call below drm_handle_vblank_events()
      * Simplify drm_vblank_work_cancel_sync()
      * Fix drm_vblank_work_cancel_sync() documentation
      * Move wake_up_all() calls out of spinlock where we can. The only one I
        left was the call to wake_up_all() in drm_vblank_handle_works() as
        this seemed like it made more sense just living in that function
        (which is all technically under lock)
      * Move drm_vblank_work related functions into their own source files
      * Add drm_vblank_internal.h so we can export some functions we don't
        want drivers using, but that we do need to use in drm_vblank_work.c
      * Add a bunch of documentation
      Changes since v4:
      * Get rid of kthread interfaces we tried adding and move all of the
        locking into drm_vblank.c. For implementing drm_vblank_work_flush(),
        we now use a wait_queue and sequence counters in order to
        differentiate between multiple work item executions.
      * Get rid of drm_vblank_work_cancel() - this would have been pretty
        difficult to actually reimplement and it occurred to me that neither
        nouveau or i915 are even planning to use this function. Since there's
        also no async cancel function for most of the work interfaces in the
        kernel, it seems a bit unnecessary anyway.
      * Get rid of to_drm_vblank_work() since we now are also able to just
        pass the struct drm_vblank_work to work item callbacks anyway
      Changes since v3:
      * Use our own spinlocks, don't integrate so tightly with kthread_works
      Changes since v2:
      * Use kthread_workers instead of reinventing the wheel.
      
      Cc: Tejun Heo <tj@kernel.org>
      Cc: dri-devel@lists.freedesktop.org
      Cc: nouveau@lists.freedesktop.org
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Co-developed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Acked-by: NDave Airlie <airlied@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200627194657.156514-4-lyude@redhat.com
      5e6c2b4f
  7. 26 3月, 2020 3 次提交
    • D
      drm: Manage drm_vblank_cleanup with drmm_ · c23d686f
      Daniel Vetter 提交于
      Nothing special here, except that this is the first time that we
      automatically clean up something that's initialized with an explicit
      driver call. But the cleanup was done at the very end of the release
      sequence for all drivers, and that's still the case. At least without
      more uses of drmm_ through explicit driver calls.
      
      Also for this one we need drmm_kcalloc, so lets add those.
      
      The motivation here is to allow us to remove the explicit calls to
      drm_dev_fini() from all drivers.
      
      v2: Sort includes (Laurent)
      
      v3: Motivate the change in the commit message better (Sam)
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-25-daniel.vetter@ffwll.ch
      c23d686f
    • D
      drm: Manage drm_gem_init with drmm_ · 641b9103
      Daniel Vetter 提交于
      We might want to look into pushing this down into drm_mm_init, but
      that would mean rolling out return codes to a pile of functions
      unfortunately. So let's leave that for now.
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-24-daniel.vetter@ffwll.ch
      641b9103
    • D
      drm: add managed resources tied to drm_device · c6603c74
      Daniel Vetter 提交于
      We have lots of these. And the cleanup code tends to be of dubious
      quality. The biggest wrong pattern is that developers use devm_, which
      ties the release action to the underlying struct device, whereas
      all the userspace visible stuff attached to a drm_device can long
      outlive that one (e.g. after a hotunplug while userspace has open
      files and mmap'ed buffers). Give people what they want, but with more
      correctness.
      
      Mostly copied from devres.c, with types adjusted to fit drm_device and
      a few simplifications - I didn't (yet) copy over everything. Since
      the types don't match code sharing looked like a hopeless endeavour.
      
      For now it's only super simplified, no groups, you can't remove
      actions (but kfree exists, we'll need that soon). Plus all specific to
      drm_device ofc, including the logging. Which I didn't bother to make
      compile-time optional, since none of the other drm logging is compile
      time optional either.
      
      One tricky bit here is the chicken&egg between allocating your
      drm_device structure and initiliazing it with drm_dev_init. For
      perfect onion unwinding we'd need to have the action to kfree the
      allocation registered before drm_dev_init registers any of its own
      release handlers. But drm_dev_init doesn't know where exactly the
      drm_device is emebedded into the overall structure, and by the time it
      returns it'll all be too late. And forcing drivers to be able clean up
      everything except the one kzalloc is silly.
      
      Work around this by having a very special final_kfree pointer. This
      also avoids troubles with the list head possibly disappearing from
      underneath us when we release all resources attached to the
      drm_device.
      
      v2: Do all the kerneldoc at the end, to avoid lots of fairly pointless
      shuffling while getting everything into shape.
      
      v3: Add static to add/del_dr (Neil)
      Move typo fix to the right patch (Neil)
      
      v4: Enforce contract for drmm_add_final_kfree:
      
      Use ksize() to check that the drm_device is indeed contained somewhere
      in the final kfree(). Because we need that or the entire managed
      release logic blows up in a pile of use-after-frees. Motivated by a
      discussion with Laurent.
      
      v5: Review from Laurent:
      - %zu instead of casting size_t
      - header guards
      - sorting of includes
      - guarding of data assignment if we didn't allocate it for a NULL
        pointer
      - delete spurious newline
      - cast void* data parameter correctly in ->release call, no idea how
        this even worked before
      
      v6: Review from Sam
      - Add the kerneldoc for the managed sub-struct back in, even if it
        doesn't show up in the generated html somehow.
      - Explain why __always_inline.
      - Fix bisectability around the final kfree() in drm_dev_relase(). This
        is just interim code which will disappear again.
      - Some whitespace polish.
      - Add debug output when drmm_add_action or drmm_kmalloc fail.
      
      v7: My bisectability fix wasn't up to par as noticed by smatch.
      
      v8: Remove unecessary {} around if else
      
      v9: Use kstrdup_const, which requires kfree_const and introducing a free_dr()
      helper (Thomas).
      
      v10: kfree_const goes boom on the plain "kmalloc" assignment, somehow
      we need to wrap that in kstrdup_const() too!! Also renumber revision
      log, I somehow reset it midway thruh.
      Reviewed-by: NSam Ravnborg <sam@ravnborg.org>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Neil Armstrong <narmstrong@baylibre.com
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200324124540.3227396-1-daniel.vetter@ffwll.ch
      c6603c74
  8. 19 3月, 2020 1 次提交
  9. 04 3月, 2020 1 次提交
  10. 11 2月, 2020 1 次提交
  11. 05 12月, 2019 1 次提交
  12. 17 6月, 2019 1 次提交
  13. 13 6月, 2019 1 次提交
  14. 28 5月, 2019 1 次提交
  15. 14 5月, 2019 2 次提交
  16. 09 5月, 2019 1 次提交
  17. 24 4月, 2019 1 次提交
    • D
      drm: allow removal of legacy codepaths (v4.1) · 61ae2270
      Dave Airlie 提交于
      If you don't want the legacy drivers, then lets get rid of all the
      legacy codepaths from the core module.
      
      This drop the size of drm.ko for me by about 10%.
       380515    7422    4192  392129   5fbc1 ../../drm-next-build/drivers/gpu/drm/drm.ko
       351736	   7298	   4192	 363226	  58ada	../../drm-next-build/drivers/gpu/drm/drm.ko
      
      v2: drop drm_lock as well, fix some DMA->DRM typos
      v3: avoid ifdefs in mainline code
      v4: rework ioctl defs
      v4.1: fix nouveau Kconfig
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      61ae2270
  18. 01 4月, 2019 4 次提交
  19. 27 12月, 2018 1 次提交
  20. 30 11月, 2018 1 次提交
    • D
      drm/lease: Send a distinct uevent · ce858828
      Daniel Vetter 提交于
      Sending the exact same hotplug event is not great uapi. Luckily the
      only already merged implementation of leases (in the -modesetting
      driver) doesn't care about what kind of uevent it gets, and
      unconditionally processes both hotplug and lease changes. So we can
      still adjust the uapi here.
      
      But e.g. weston tries to filter stuff, and I guess others might want
      to do that too. Try to make that possible. Cc: stable since it's uapi
      adjustement that we want to roll out everywhere.
      
      Michel Dänzer mentioned on irc that -amdgpu also has lease support. It
      has the same code flow as -modesetting though, so we can still go
      ahead.
      
      v2: Mention -amdgpu (Michel)
      
      Cc: Keith Packard <keithp@keithp.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NKeith Packard <keithp@keithp.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181129094226.30591-1-daniel.vetter@ffwll.ch
      ce858828
  21. 22 11月, 2018 1 次提交
  22. 09 9月, 2018 1 次提交
  23. 25 6月, 2018 1 次提交
  24. 11 11月, 2017 1 次提交
  25. 23 10月, 2017 1 次提交
    • K
      drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v3] · 3064abfa
      Keith Packard 提交于
      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: NDaniel Vetter <daniel@ffwll.ch>
      Suggested-by: NVille 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: NMichel Dänzer <michel@daenzer.net>
      Acked-by: NDave Airlie <airlied@redhat.com>
      
      [airlied: left->leaves (Michel)]
      Signed-off-by: NKeith Packard <keithp@keithp.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      3064abfa
  26. 13 10月, 2017 1 次提交
  27. 29 8月, 2017 3 次提交
    • J
      drm/syncobj: Add a signal ioctl (v3) · ffa9443f
      Jason Ekstrand 提交于
      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: NJason Ekstrand <jason@jlekstrand.net>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      ffa9443f
    • J
      drm/syncobj: Add a reset ioctl (v3) · aa4035d2
      Jason Ekstrand 提交于
      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: NJason Ekstrand <jason@jlekstrand.net>
      Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      aa4035d2
    • D
      drm/syncobj: add sync obj wait interface. (v8) · 5e60a10e
      Dave Airlie 提交于
      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: NDave Airlie <airlied@redhat.com>
      Reviewed-by: NJason Ekstrand <jason@jlekstrand.net>
      Acked-by: NChristian König <christian.koenig@amd.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      5e60a10e
  28. 28 6月, 2017 1 次提交
    • D
      drm/vblank: Unexport drm_vblank_cleanup · b4164d66
      Daniel Vetter 提交于
      There's no reason for drivers to call this, and all the ones I've
      removed looked very fishy:
      - Proper quiescenting of the vblank machinery should be done by
        calling drm_crtc_vblank_off(), which is best done by shutting down
        the entire display engine with drm_atomic_helper_shutdown.
      
      - Releasing of allocated memory is done by the core already, it calls
        drm_vblank_cleanup as a fallback.
      
      - drm_vblank_cleanup also has checks for drivers which forget to clean
        up vblank interrupts.
      
      This essentially reverts
      
      commit e77cef9c
      Author: Jerome Glisse <jglisse@redhat.com>
      Date:   Thu Jan 7 15:39:13 2010 +0100
      
          drm: Avoid calling vblank function is vblank wasn't initialized
      
      which was done to fix a bug in radeon code with msi interrupts:
      
      commit 003e69f9
      Author: Jerome Glisse <jglisse@redhat.com>
      Date:   Thu Jan 7 15:39:14 2010 +0100
      
          drm/radeon/kms: Don't try to enable IRQ if we have no handler installed
      
      Afaict from digging around in old code, this was needed to avoid
      blowing up in the ums fallback, and has stopped serving it's purpose
      long ago - if irq init fails, the driver fails to load, and there's
      really no way to blow up anymore.
      
      Long story short, this was most likely a small ums compat/fallback
      hack that became a thing of it's own and got cargo-cult duplicated all
      over the drm codebase for essentially no gain at all.
      
      v2: Mention that for drivers with a ->release callback cleanup is
      handled by drm_dev_fini() (Thierry).
      
      Cc: Thierry Reding <treding@nvidia.com>
      Acked-by: NThierry Reding <treding@nvidia.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Acked-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170626161949.25629-2-daniel.vetter@ffwll.ch
      b4164d66
  29. 20 6月, 2017 2 次提交
  30. 14 6月, 2017 1 次提交
    • D
      drm: introduce sync objects (v4) · e9083420
      Dave Airlie 提交于
      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: NSean Paul <seanpaul@chromium.org>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      e9083420
  31. 01 6月, 2017 1 次提交