1. 05 4月, 2017 2 次提交
  2. 06 3月, 2017 1 次提交
  3. 28 2月, 2017 6 次提交
  4. 27 2月, 2017 1 次提交
    • M
      drm: Add a new connector atomic property for link status · 40ee6fbe
      Manasi Navare 提交于
      At the time userspace does setcrtc, we've already promised the mode
      would work. The promise is based on the theoretical capabilities of
      the link, but it's possible we can't reach this in practice. The DP
      spec describes how the link should be reduced, but we can't reduce
      the link below the requirements of the mode. Black screen follows.
      
      One idea would be to have setcrtc return a failure. However, it
      already should not fail as the atomic checks have passed. It would
      also conflict with the idea of making setcrtc asynchronous in the
      future, returning before the actual mode setting and link training.
      
      Another idea is to train the link "upfront" at hotplug time, before
      pruning the mode list, so that we can do the pruning based on
      practical not theoretical capabilities. However, the changes for link
      training are pretty drastic, all for the sake of error handling and
      DP compliance, when the most common happy day scenario is the current
      approach of link training at mode setting time, using the optimal
      parameters for the mode. It is also not certain all hardware could do
      this without the pipe on; not even all our hardware can do this. Some
      of this can be solved, but not trivially.
      
      Both of the above ideas also fail to address link degradation *during*
      operation.
      
      The solution is to add a new "link-status" connector property in order
      to address link training failure in a way that:
      a) changes the current happy day scenario as little as possible, to
      avoid regressions, b) can be implemented the same way by all drm
      drivers, c) is still opt-in for the drivers and userspace, and opting
      out doesn't regress the user experience, d) doesn't prevent drivers
      from implementing better or alternate approaches, possibly without
      userspace involvement. And, of course, handles all the issues presented.
      In the usual happy day scenario, this is always "good". If something
      fails during or after a mode set, the kernel driver can set the link
      status to "bad" and issue a hotplug uevent for userspace to have it
      re-check the valid modes through GET_CONNECTOR IOCTL, and try modeset
      again. If the theoretical capabilities of the link can't be reached,
      the mode list is trimmed based on that.
      
      v7 by Jani:
      * Rebase, simplify set property while at it, checkpatch fix
      v6:
      * Fix a typo in kernel doc (Sean Paul)
      v5:
      * Clarify doc for silent rejection of atomic properties by driver (Daniel Vetter)
      v4:
      * Add comments in kernel-doc format (Daniel Vetter)
      * Update the kernel-doc for link-status (Sean Paul)
      v3:
      * Fixed a build error (Jani Saarinen)
      v2:
      * Removed connector->link_status (Daniel Vetter)
      * Set connector->state->link_status in drm_mode_connector_set_link_status_property
      (Daniel Vetter)
      * Set the connector_changed flag to true if connector->state->link_status changed.
      * Reset link_status to GOOD in update_output_state (Daniel Vetter)
      * Never allow userspace to set link status from Good To Bad (Daniel Vetter)
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NJani Nikula <jani.nikula@intel.com>
      Acked-by: NTony Cheng <tony.cheng@amd.com>
      Acked-by: NHarry Wentland <harry.wentland@amd.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Sean Paul <seanpaul@chromium.org>
      Signed-off-by: NManasi Navare <manasi.d.navare@intel.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Acked-by: Eric Anholt <eric@anholt.net> (for the -modesetting patch)
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/0182487051aa9f1594820e35a4853de2f8747b4e.1481883920.git.jani.nikula@intel.com
      40ee6fbe
  5. 17 2月, 2017 1 次提交
  6. 15 2月, 2017 5 次提交
  7. 31 1月, 2017 2 次提交
    • M
      drm/atomic: Fix double free in drm_atomic_state_default_clear · 92c715fc
      Maarten Lankhorst 提交于
      drm_atomic_helper_page_flip and drm_atomic_ioctl set their own events
      in crtc_state->event. But when it's set the event is freed in 2 places.
      
      Solve this by only freeing the event in the atomic ioctl when it
      allocated its own event.
      
      This has been broken twice. The first time when the code was introduced,
      but only in the corner case when an event is allocated, but more crtc's
      were included by atomic check and then failing. This can mostly
      happen when you do an atomic modeset in i915 and the display clock is
      changed, which forces all crtc's to be included to the state.
      
      This has been broken worse by adding in-fences support, which caused
      the double free to be done unconditionally.
      
      [IGT] kms_rotation_crc: starting subtest primary-rotation-180
      =============================================================================
      BUG kmalloc-128 (Tainted: G     U         ): Object already free
      -----------------------------------------------------------------------------
      
      Disabling lock debugging due to kernel taint
      INFO: Allocated in drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper] age=0 cpu=3 pid=1529
       ___slab_alloc+0x308/0x3b0
       __slab_alloc+0xd/0x20
       kmem_cache_alloc_trace+0x92/0x1c0
       drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper]
       intel_atomic_commit+0x35/0x4f0 [i915]
       drm_atomic_commit+0x46/0x50 [drm]
       drm_mode_atomic_ioctl+0x7d4/0xab0 [drm]
       drm_ioctl+0x2b3/0x490 [drm]
       do_vfs_ioctl+0x69c/0x700
       SyS_ioctl+0x4e/0x80
       entry_SYSCALL_64_fastpath+0x13/0x94
      INFO: Freed in drm_event_cancel_free+0xa3/0xb0 [drm] age=0 cpu=3 pid=1529
       __slab_free+0x48/0x2e0
       kfree+0x159/0x1a0
       drm_event_cancel_free+0xa3/0xb0 [drm]
       drm_mode_atomic_ioctl+0x86d/0xab0 [drm]
       drm_ioctl+0x2b3/0x490 [drm]
       do_vfs_ioctl+0x69c/0x700
       SyS_ioctl+0x4e/0x80
       entry_SYSCALL_64_fastpath+0x13/0x94
      INFO: Slab 0xffffde1f0997b080 objects=17 used=2 fp=0xffff92fb65ec2578 flags=0x200000000008101
      INFO: Object 0xffff92fb65ec2578 @offset=1400 fp=0xffff92fb65ec2ae8
      
      Redzone ffff92fb65ec2570: bb bb bb bb bb bb bb bb                          ........
      Object ffff92fb65ec2578: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec2588: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec2598: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25d8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff92fb65ec25e8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  kkkkkkkkkkkkkkk.
      Redzone ffff92fb65ec25f8: bb bb bb bb bb bb bb bb                          ........
      Padding ffff92fb65ec2738: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
      CPU: 3 PID: 180 Comm: kworker/3:2 Tainted: G    BU          4.10.0-rc6-patser+ #5039
      Hardware name:                  /NUC5PPYB, BIOS PYBSWCEL.86A.0031.2015.0601.1712 06/01/2015
      Workqueue: events intel_atomic_helper_free_state [i915]
      Call Trace:
       dump_stack+0x4d/0x6d
       print_trailer+0x20c/0x220
       free_debug_processing+0x1c6/0x330
       ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
       __slab_free+0x48/0x2e0
       ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
       kfree+0x159/0x1a0
       drm_atomic_state_default_clear+0xf7/0x1c0 [drm]
       ? drm_atomic_state_clear+0x30/0x30 [drm]
       intel_atomic_state_clear+0xd/0x20 [i915]
       drm_atomic_state_clear+0x1a/0x30 [drm]
       __drm_atomic_state_free+0x13/0x60 [drm]
       intel_atomic_helper_free_state+0x5d/0x70 [i915]
       process_one_work+0x260/0x4a0
       worker_thread+0x2d1/0x4f0
       kthread+0x127/0x130
       ? process_one_work+0x4a0/0x4a0
       ? kthread_stop+0x120/0x120
       ret_from_fork+0x29/0x40
      FIX kmalloc-128: Object at 0xffff92fb65ec2578 not freed
      
      Fixes: 3b24f7d6 ("drm/atomic: Add struct drm_crtc_commit to track async updates")
      Fixes: 96260142 ("drm/fence: add in-fences support")
      Cc: <stable@vger.kernel.org> # v4.8+
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NGustavo Padovan <gustavo.padovan@collabora.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1485854725-27640-1-git-send-email-maarten.lankhorst@linux.intel.com
      92c715fc
    • D
      drm/docs: Fix documentation for drm_atomic_set_mode_for_crtc · cbef9099
      Dhinakaran Pandiyan 提交于
      drm_atomic_set_mode_for_crtc() modifies the .enable member of CRTC state
      but documentation claims otherwise, fix that.
      Signed-off-by: NDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1485843518-28438-1-git-send-email-dhinakaran.pandiyan@intel.com
      cbef9099
  8. 27 1月, 2017 1 次提交
  9. 25 1月, 2017 1 次提交
  10. 17 1月, 2017 1 次提交
  11. 05 1月, 2017 1 次提交
  12. 04 1月, 2017 1 次提交
  13. 30 12月, 2016 1 次提交
  14. 18 12月, 2016 1 次提交
    • D
      drm: locking&new iterators for connector_list · 613051da
      Daniel Vetter 提交于
      The requirements for connector_list locking are a bit tricky:
      - We need to be able to jump over zombie conectors (i.e. with refcount
        == 0, but not yet removed from the list). If instead we require that
        there's no zombies on the list then the final kref_put must happen
        under the list protection lock, which means that locking context
        leaks all over the place. Not pretty - better to deal with zombies
        and wrap the locking just around the list_del in the destructor.
      
      - When we walk the list we must _not_ hold the connector list lock. We
        walk the connector list at an absolutely massive amounts of places,
        if all those places can't ever call drm_connector_unreference the
        code would get unecessarily complicated.
      
      - connector_list needs it own lock, again too many places that walk it
        that we could reuse e.g. mode_config.mutex without resulting in
        inversions.
      
      - Lots of code uses these loops to look-up a connector, i.e. they want
        to be able to call drm_connector_reference. But on the other hand we
        want connectors to stay on that list until they're dead (i.e.
        connector_list can't hold a full reference), which means despite the
        "can't hold lock for the loop body" rule we need to make sure a
        connector doesn't suddenly become a zombie.
      
      At first Dave&I discussed various horror-show approaches using srcu,
      but turns out it's fairly easy:
      
      - For the loop body we always hold an additional reference to the
        current connector. That means it can't zombify, and it also means
        it'll stay on the list, which means we can use it as our iterator to
        find the next connector.
      
      - When we try to find the next connector we only have to jump over
        zombies. To make sure we don't chase bad pointers that entire loop
        is protected with the new connect_list_lock spinlock. And because we
        know that we're starting out with a non-zombie (need to drop our
        reference for the old connector only after we have our new one),
        we're guranteed to still be on the connector_list and either find
        the next non-zombie or complete the iteration.
      
      - Only downside is that we need to make sure that the temporary
        reference for the loop body doesn't leak. iter_get/put() functions +
        lockdep make sure that's the case.
      
      - To avoid a flag day the new iterator macro has an _iter postfix. We
        can rename it back once all the users of the unsafe version are gone
        (there's about 100 list walkers for the connector_list).
      
      For now this patch only converts all the list walking in the core,
      leaving helpers and drivers for later patches. The nice thing is that
      we can now finally remove 2 FIXME comments from the
      register/unregister functions.
      
      v2:
      - use irqsafe spinlocks, so that we can use this in drm_state_dump
        too.
      - nuke drm_modeset_lock_all from drm_connector_init, now entirely
        cargo-culted nonsense.
      
      v3:
      - do {} while (!kref_get_unless_zero), makes for a tidier loop (Dave).
      - pretty kerneldoc
      - add EXPORT_SYMBOL, helpers&drivers are supposed to use this.
      
      v4: Change lockdep annotations to only check whether we release the
      iter fake lock again (i.e. make sure that iter_put is called), but
      not check any locking dependecies itself. That seams to require a
      recursive read lock in trylock mode.
      
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20161213230814.19598-6-daniel.vetter@ffwll.ch
      613051da
  15. 15 12月, 2016 3 次提交
  16. 10 12月, 2016 1 次提交
  17. 07 12月, 2016 1 次提交
  18. 29 11月, 2016 1 次提交
  19. 22 11月, 2016 2 次提交
  20. 17 11月, 2016 1 次提交
  21. 16 11月, 2016 2 次提交
    • G
      drm/fence: add out-fences support · beaf5af4
      Gustavo Padovan 提交于
      Support DRM out-fences by creating a sync_file with a fence for each CRTC
      that sets the OUT_FENCE_PTR property.
      
      We use the out_fence pointer received in the OUT_FENCE_PTR prop to send
      the sync_file fd back to userspace.
      
      The sync_file and fd are allocated/created before commit, but the
      fd_install operation only happens after we know that commit succeed.
      
      v2: Comment by Rob Clark:
      	- Squash commit that adds DRM_MODE_ATOMIC_OUT_FENCE flag here.
      
          Comment by Daniel Vetter:
      	- Add clean up code for out_fences
      
      v3: Comments by Daniel Vetter:
      	- create DRM_MODE_ATOMIC_EVENT_MASK
      	- userspace should fill out_fences_ptr with the crtc_ids for which
      	it wants fences back.
      
      v4: Create OUT_FENCE_PTR properties and remove old approach.
      
      v5: Comments by Brian Starkey:
      	- Remove extra fence_get() in atomic_ioctl()
      	- Check ret before iterating on the crtc_state
      	- check ret before fd_install
      	- set fence_state to NULL at the beginning
      	- check fence_state->out_fence_ptr before put_user()
      	- change order of fput() and put_unused_fd() on failure
      
           - Add access_ok() check to the out_fence_ptr received
           - Rebase after fence -> dma_fence rename
           - Store out_fence_ptr in the drm_atomic_state
           - Split crtc_setup_out_fence()
           - return -1 as out_fence with TEST_ONLY flag
      
      v6: Comments by Daniel Vetter
      	- Add prepare/unprepare_crtc_signaling()
      	- move struct drm_out_fence_state to drm_atomic.c
      	- mark get_crtc_fence() as static
      
          Comments by Brian Starkey
      	- proper set fence_ptr fence_state array
      	- isolate fence_idx increment
      
          - improve error handling
      
      v7: Comments by Daniel Vetter
      	- remove prefix from internal functions
      	- make out_fence_ptr an s64 pointer
      	- degrade DRM_INFO to DRM_DEBUG_ATOMIC when put_user fail
      	- fix doc issues
      	- filter out OUT_FENCE_PTR == NULL and do not fail in this case
      	- add complete_crtc_signalling()
      	- krealloc fence_state on demand
      
          Comment by Brian Starkey
      	- remove unused crtc_state arg from get_out_fence()
      
      v8: Comment by Brian Starkey
      	- cancel events before check for !fence_state
      	- convert a few lefovers u64 types for out_fence_ptr
      	- fix memleak by assign fence_state earlier after realloc
      	- proper accout num_fences in case of error
      
      v9: Comment by Brian Starkey
      	- memset last position of fence_state after krealloc
          Comments by Sean Paul
      	- pass install_fds in complete_crtc_signaling() instead of ret
      
           - put_user(-1, fence_ptr) when decoding props
      
      v10: Comment by Brian Starkey
      	- remove unneeded num_fences increment on error path
      	- kfree fence_state after installing fences fd
      
      v11: rebase against latest drm-misc
      
      v12: rebase again against latest drm-misc
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Reviewed-by: Brian Starkey <brian.starkey@arm.com> (v10)
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Tested-by: Robert Foss <robert.foss@collabora.com> (v10)
      [danvet: Appease checkpatch.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1479301221-13056-1-git-send-email-gustavo@padovan.org
      beaf5af4
    • G
      drm/fence: add in-fences support · 96260142
      Gustavo Padovan 提交于
      There is now a new property called IN_FENCE_FD attached to every plane
      state that receives sync_file fds from userspace via the atomic commit
      IOCTL.
      
      The fd is then translated to a fence (that may be a fence_array
      subclass or just a normal fence) and then used by DRM to fence_wait() for
      all fences in the sync_file to signal. So it only commits when all
      framebuffers are ready to scanout.
      
      v2: Comments by Daniel Vetter:
      	- remove set state->fence = NULL in destroy phase
      	- accept fence -1 as valid and just return 0
      	- do not call fence_get() - sync_file_fences_get() already calls it
      	- fence_put() if state->fence is already set, in case userspace
      	set the property more than once.
      
      v3: WARN_ON if fence is set but state has no FB
      
      v4: Comment from Maarten Lankhorst
      	- allow set fence with no related fb
      
      v5: rename FENCE_FD to IN_FENCE_FD
      
      v6: Comments by Daniel Vetter:
      	- rename plane_state->in_fence back to "fence"
      	- re-introduce WARN_ON if fence set but no fb
      
           - rebase after fence -> dma_fence rename
      
      v7: Comments by Brian Starkey
      	- set state->fence to NULL when duplicating the state
      	- fail if IN_FENCE_FD was already set
      
      v8: rebase against latest drm-misc
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Reviewed-by: NBrian Starkey <brian.starkey@arm.com>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Tested-by: NRobert Foss <robert.foss@collabora.com>
      [danvet: Rebase onto extracted drm_mode_config.[hc].]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      96260142
  22. 12 11月, 2016 1 次提交
  23. 09 11月, 2016 2 次提交
  24. 08 11月, 2016 1 次提交